Twig update to > 2.11: Fixed namespaces, warnings and cleanup
This commit is contained in:
parent
f8e1f85089
commit
15e6740e12
|
@ -40,7 +40,7 @@
|
||||||
"swiftmailer/swiftmailer": "^6.2",
|
"swiftmailer/swiftmailer": "^6.2",
|
||||||
"symfony/http-foundation": "^4.3",
|
"symfony/http-foundation": "^4.3",
|
||||||
"symfony/psr-http-message-bridge": "^1.2",
|
"symfony/psr-http-message-bridge": "^1.2",
|
||||||
"twig/twig": "~2.6.0",
|
"twig/twig": "^2.11",
|
||||||
"vlucas/phpdotenv": "^3.3"
|
"vlucas/phpdotenv": "^3.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
{% import _self as elements %}
|
|
||||||
|
|
||||||
{% macro toolbar_item(label, link, active_page, icon) %}
|
{% macro toolbar_item(label, link, active_page, icon) %}
|
||||||
<li{% if page() == active_page %} class="active"{% endif %}>
|
<li{% if page() == active_page %} class="active"{% endif %}>
|
||||||
<a href="{{ link }}">
|
<a href="{{ link }}">
|
||||||
|
@ -36,23 +34,23 @@
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
|
||||||
{% if is_user() %}
|
{% if is_user() %}
|
||||||
{{ elements.toolbar_item(menuUserShiftState(user), url('shifts', {'action': 'next'}), '', 'glyphicon-time') }}
|
{{ _self.toolbar_item(menuUserShiftState(user), url('shifts', {'action': 'next'}), '', 'glyphicon-time') }}
|
||||||
{% elseif has_permission_to('register') and config('registration_enabled') %}
|
{% elseif has_permission_to('register') and config('registration_enabled') %}
|
||||||
{{ elements.toolbar_item(__('Register'), url('register'), 'register', 'glyphicon-plus') }}
|
{{ _self.toolbar_item(__('Register'), url('register'), 'register', 'glyphicon-plus') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('login') %}
|
{% if has_permission_to('login') %}
|
||||||
{{ elements.toolbar_item(__('Login'), url('login'), 'login', 'glyphicon-log-in') }}
|
{{ _self.toolbar_item(__('Login'), url('login'), 'login', 'glyphicon-log-in') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if is_user() and has_permission_to('user_messages') %}
|
{% if is_user() and has_permission_to('user_messages') %}
|
||||||
{{ elements.toolbar_item(menuUserMessages(), url('user-messages'), 'user-messages', 'glyphicon-envelope') }}
|
{{ _self.toolbar_item(menuUserMessages(), url('user-messages'), 'user-messages', 'glyphicon-envelope') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ menuUserHints() }}
|
{{ menuUserHints() }}
|
||||||
|
|
||||||
{% if has_permission_to('user_myshifts') %}
|
{% if has_permission_to('user_myshifts') %}
|
||||||
{{ elements.toolbar_item(user.name, url('users', {'action': 'view'}), 'users', 'icon icon-icon_angel') }}
|
{{ _self.toolbar_item(user.name, url('users', {'action': 'view'}), 'users', 'icon icon-icon_angel') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
(__('Event starts')): config('event_start'),
|
(__('Event starts')): config('event_start'),
|
||||||
(__('Event ends')): config('event_end'),
|
(__('Event ends')): config('event_end'),
|
||||||
(__('Teardown ends')): config('teardown_end')
|
(__('Teardown ends')): config('teardown_end')
|
||||||
} if date %}
|
} | filter(date => date) %}
|
||||||
{% if date > date() %}
|
{% if date > date() %}
|
||||||
<div class="col-sm-3 text-center hidden-xs">
|
<div class="col-sm-3 text-center hidden-xs">
|
||||||
<h4>{{ name }}</h4>
|
<h4>{{ name }}</h4>
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\MiddlewareInterface;
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
use Twig_LoaderInterface as TwigLoader;
|
use Twig\Loader\LoaderInterface as TwigLoader;
|
||||||
|
|
||||||
class ErrorHandler implements MiddlewareInterface
|
class ErrorHandler implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Http\UrlGenerator;
|
use Engelsystem\Http\UrlGenerator;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Assets extends TwigExtension
|
class Assets extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Helpers\Authenticator;
|
use Engelsystem\Helpers\Authenticator;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Authentication extends TwigExtension
|
class Authentication extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Config\Config as EngelsystemConfig;
|
use Engelsystem\Config\Config as EngelsystemConfig;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Config extends TwigExtension
|
class Config extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Csrf extends TwigExtension
|
class Csrf extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Helpers\Authenticator;
|
use Engelsystem\Helpers\Authenticator;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Extension_GlobalsInterface as GlobalsInterface;
|
use Twig\Extension\GlobalsInterface as GlobalsInterface;
|
||||||
|
|
||||||
class Globals extends TwigExtension implements GlobalsInterface
|
class Globals extends TwigExtension implements GlobalsInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Http\Request;
|
use Engelsystem\Http\Request;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Legacy extends TwigExtension
|
class Legacy extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Parsedown;
|
use Parsedown;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Filter as TwigFilter;
|
use Twig\TwigFilter;
|
||||||
|
|
||||||
class Markdown extends TwigExtension
|
class Markdown extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Session\Session as SymfonySession;
|
use Symfony\Component\HttpFoundation\Session\Session as SymfonySession;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Session extends TwigExtension
|
class Session extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Helpers\Translation\Translator;
|
use Engelsystem\Helpers\Translation\Translator;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Filter as TwigFilter;
|
use Twig\TwigFilter;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Translation extends TwigExtension
|
class Translation extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
namespace Engelsystem\Renderer\Twig\Extensions;
|
namespace Engelsystem\Renderer\Twig\Extensions;
|
||||||
|
|
||||||
use Engelsystem\Http\UrlGenerator;
|
use Engelsystem\Http\UrlGenerator;
|
||||||
use Twig_Extension as TwigExtension;
|
use Twig\Extension\AbstractExtension as TwigExtension;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
class Url extends TwigExtension
|
class Url extends TwigExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
namespace Engelsystem\Renderer;
|
namespace Engelsystem\Renderer;
|
||||||
|
|
||||||
use Twig_Environment as Twig;
|
use Twig\Environment as Twig;
|
||||||
use Twig_Error_Loader as LoaderError;
|
use Twig\Error\LoaderError as LoaderError;
|
||||||
use Twig_Error_Runtime as RuntimeError;
|
use Twig\Error\RuntimeError as RuntimeError;
|
||||||
use Twig_Error_Syntax as SyntaxError;
|
use Twig\Error\SyntaxError as SyntaxError;
|
||||||
|
|
||||||
class TwigEngine extends Engine
|
class TwigEngine extends Engine
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
namespace Engelsystem\Renderer;
|
namespace Engelsystem\Renderer;
|
||||||
|
|
||||||
use Twig_Error_Loader;
|
use Twig\Error\LoaderError as ErrorLoader;
|
||||||
use Twig_Loader_Filesystem as FilesystemLoader;
|
use Twig\Loader\FilesystemLoader as FilesystemLoader;
|
||||||
|
|
||||||
class TwigLoader extends FilesystemLoader
|
class TwigLoader extends FilesystemLoader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param bool $throw
|
* @param bool $throw
|
||||||
* @return false|string
|
* @return string|false|null
|
||||||
* @throws Twig_Error_Loader
|
* @throws ErrorLoader
|
||||||
*/
|
*/
|
||||||
public function findTemplate($name, $throw = true)
|
public function findTemplate($name, $throw = true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,9 +14,9 @@ use Engelsystem\Renderer\Twig\Extensions\Markdown;
|
||||||
use Engelsystem\Renderer\Twig\Extensions\Session;
|
use Engelsystem\Renderer\Twig\Extensions\Session;
|
||||||
use Engelsystem\Renderer\Twig\Extensions\Translation;
|
use Engelsystem\Renderer\Twig\Extensions\Translation;
|
||||||
use Engelsystem\Renderer\Twig\Extensions\Url;
|
use Engelsystem\Renderer\Twig\Extensions\Url;
|
||||||
use Twig_Environment as Twig;
|
use Twig\Environment as Twig;
|
||||||
use Twig_Extension_Core as TwigCore;
|
use Twig\Extension\CoreExtension as TwigCore;
|
||||||
use Twig_LoaderInterface as TwigLoaderInterface;
|
use Twig\Loader\LoaderInterface as TwigLoaderInterface;
|
||||||
|
|
||||||
class TwigServiceProvider extends ServiceProvider
|
class TwigServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||||
use Twig_LoaderInterface as TwigLoader;
|
use Twig\Loader\LoaderInterface as TwigLoader;
|
||||||
|
|
||||||
class ErrorHandlerTest extends TestCase
|
class ErrorHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,8 @@ use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
|
||||||
use Exception;
|
use Exception;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Twig_Function as TwigFunction;
|
use Twig\TwigFunction;
|
||||||
use Twig_Node as TwigNode;
|
use Twig\Node\Node as TwigNode;
|
||||||
|
|
||||||
abstract class ExtensionTest extends TestCase
|
abstract class ExtensionTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,8 @@ namespace Engelsystem\Test\Unit\Renderer;
|
||||||
use Engelsystem\Renderer\TwigEngine;
|
use Engelsystem\Renderer\TwigEngine;
|
||||||
use PHPUnit\Framework\MockObject\MockObject;
|
use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Twig_Environment as Twig;
|
use Twig\Environment as Twig;
|
||||||
use Twig_LoaderInterface as LoaderInterface;
|
use Twig\Loader\LoaderInterface as LoaderInterface;
|
||||||
|
|
||||||
class TwigEngineTest extends TestCase
|
class TwigEngineTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,10 +11,10 @@ use PHPUnit\Framework\MockObject\MockObject;
|
||||||
use ReflectionClass as Reflection;
|
use ReflectionClass as Reflection;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Twig_Environment as Twig;
|
use Twig\Environment as Twig;
|
||||||
use Twig_Extension_Core as TwigCore;
|
use Twig\Extension\CoreExtension as TwigCore;
|
||||||
use Twig_ExtensionInterface as ExtensionInterface;
|
use Twig\Extension\ExtensionInterface as ExtensionInterface;
|
||||||
use Twig_LoaderInterface as TwigLoaderInterface;
|
use Twig\Loader\LoaderInterface as TwigLoaderInterface;
|
||||||
|
|
||||||
class TwigServiceProviderTest extends ServiceProviderTest
|
class TwigServiceProviderTest extends ServiceProviderTest
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue