Twig update to > 2.11: Fixed namespaces, warnings and cleanup

main
Igor Scheller 6 years ago
parent f8e1f85089
commit 15e6740e12

@ -40,7 +40,7 @@
"swiftmailer/swiftmailer": "^6.2",
"symfony/http-foundation": "^4.3",
"symfony/psr-http-message-bridge": "^1.2",
"twig/twig": "~2.6.0",
"twig/twig": "^2.11",
"vlucas/phpdotenv": "^3.3"
},
"require-dev": {

@ -1,5 +1,3 @@
{% import _self as elements %}
{% macro toolbar_item(label, link, active_page, icon) %}
<li{% if page() == active_page %} class="active"{% endif %}>
<a href="{{ link }}">
@ -36,23 +34,23 @@
<ul class="nav navbar-nav navbar-right">
{% 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') %}
{{ elements.toolbar_item(__('Register'), url('register'), 'register', 'glyphicon-plus') }}
{{ _self.toolbar_item(__('Register'), url('register'), 'register', 'glyphicon-plus') }}
{% endif %}
{% 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 %}
{% 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 %}
{{ menuUserHints() }}
{% 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 %}
<li class="dropdown">

@ -17,7 +17,7 @@
(__('Event starts')): config('event_start'),
(__('Event ends')): config('event_end'),
(__('Teardown ends')): config('teardown_end')
} if date %}
} | filter(date => date) %}
{% if date > date() %}
<div class="col-sm-3 text-center hidden-xs">
<h4>{{ name }}</h4>

@ -11,7 +11,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Twig_LoaderInterface as TwigLoader;
use Twig\Loader\LoaderInterface as TwigLoader;
class ErrorHandler implements MiddlewareInterface
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Http\UrlGenerator;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Assets extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Helpers\Authenticator;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Authentication extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Config\Config as EngelsystemConfig;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Config extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Csrf extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Helpers\Authenticator;
use Twig_Extension as TwigExtension;
use Twig_Extension_GlobalsInterface as GlobalsInterface;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\Extension\GlobalsInterface as GlobalsInterface;
class Globals extends TwigExtension implements GlobalsInterface
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Http\Request;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Legacy extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Parsedown;
use Twig_Extension as TwigExtension;
use Twig_Filter as TwigFilter;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFilter;
class Markdown extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Symfony\Component\HttpFoundation\Session\Session as SymfonySession;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Session extends TwigExtension
{

@ -3,9 +3,9 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Helpers\Translation\Translator;
use Twig_Extension as TwigExtension;
use Twig_Filter as TwigFilter;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
class Translation extends TwigExtension
{

@ -3,8 +3,8 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Http\UrlGenerator;
use Twig_Extension as TwigExtension;
use Twig_Function as TwigFunction;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFunction;
class Url extends TwigExtension
{

@ -2,10 +2,10 @@
namespace Engelsystem\Renderer;
use Twig_Environment as Twig;
use Twig_Error_Loader as LoaderError;
use Twig_Error_Runtime as RuntimeError;
use Twig_Error_Syntax as SyntaxError;
use Twig\Environment as Twig;
use Twig\Error\LoaderError as LoaderError;
use Twig\Error\RuntimeError as RuntimeError;
use Twig\Error\SyntaxError as SyntaxError;
class TwigEngine extends Engine
{

@ -2,16 +2,16 @@
namespace Engelsystem\Renderer;
use Twig_Error_Loader;
use Twig_Loader_Filesystem as FilesystemLoader;
use Twig\Error\LoaderError as ErrorLoader;
use Twig\Loader\FilesystemLoader as FilesystemLoader;
class TwigLoader extends FilesystemLoader
{
/**
* @param string $name
* @param bool $throw
* @return false|string
* @throws Twig_Error_Loader
* @return string|false|null
* @throws ErrorLoader
*/
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\Translation;
use Engelsystem\Renderer\Twig\Extensions\Url;
use Twig_Environment as Twig;
use Twig_Extension_Core as TwigCore;
use Twig_LoaderInterface as TwigLoaderInterface;
use Twig\Environment as Twig;
use Twig\Extension\CoreExtension as TwigCore;
use Twig\Loader\LoaderInterface as TwigLoaderInterface;
class TwigServiceProvider extends ServiceProvider
{

@ -19,7 +19,7 @@ use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Twig_LoaderInterface as TwigLoader;
use Twig\Loader\LoaderInterface as TwigLoader;
class ErrorHandlerTest extends TestCase
{

@ -6,8 +6,8 @@ use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Twig_Function as TwigFunction;
use Twig_Node as TwigNode;
use Twig\TwigFunction;
use Twig\Node\Node as TwigNode;
abstract class ExtensionTest extends TestCase
{

@ -5,8 +5,8 @@ namespace Engelsystem\Test\Unit\Renderer;
use Engelsystem\Renderer\TwigEngine;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Twig_Environment as Twig;
use Twig_LoaderInterface as LoaderInterface;
use Twig\Environment as Twig;
use Twig\Loader\LoaderInterface as LoaderInterface;
class TwigEngineTest extends TestCase
{

@ -11,10 +11,10 @@ use PHPUnit\Framework\MockObject\MockObject;
use ReflectionClass as Reflection;
use ReflectionException;
use stdClass;
use Twig_Environment as Twig;
use Twig_Extension_Core as TwigCore;
use Twig_ExtensionInterface as ExtensionInterface;
use Twig_LoaderInterface as TwigLoaderInterface;
use Twig\Environment as Twig;
use Twig\Extension\CoreExtension as TwigCore;
use Twig\Extension\ExtensionInterface as ExtensionInterface;
use Twig\Loader\LoaderInterface as TwigLoaderInterface;
class TwigServiceProviderTest extends ServiceProviderTest
{

Loading…
Cancel
Save