php-debugbar icon indicating copy to clipboard operation
php-debugbar copied to clipboard

Twig 2 and the default collector

Open hultberg opened this issue 9 years ago • 0 comments

While adding the default TwigCollector with an TraceableTwigEnvironment I get this error:

Declaration of DebugBar\Bridge\Twig\TraceableTwigEnvironment::setLexer(Twig_LexerInterface $lexer) should be compatible with Twig_Environment::setLexer(Twig_Lexer $lexer)

The LexerInterface has been deprecated in twig since v1.12 and has been removed in v2.0. I suggest changing the declaration of TraceableTwigEnvironment::setLexer(Twig_LexerInterface) to be TraceableTwigEnvironment::setLexer(Twig_Lexer). However, this might break some projects if they have implemented Twig_LexerInterface and not extending Twig_Lexer.

While browsing the file TraceableTwigEnvironment, it seems it should be reviewed to work with twig 2.0.

Versions:

PHP: 7.1
Twig: 2.2.0
Debugbar: 1.13.1

hultberg avatar Mar 12 '17 17:03 hultberg