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

not work with twig

Open dimaxz opened this issue 7 years ago • 2 comments

$bar = new StandardDebugBar; $bar->addCollector(

                new TwigCollector(
                        new TraceableTwigEnvironment(
                        new Twig_Environment , new TimeDataCollector
                        )
                )

)

dimaxz avatar Mar 30 '18 21:03 dimaxz

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

dimaxz avatar Mar 31 '18 18:03 dimaxz

Try this:

$twig         = new \Twig\Environment( new \Twig\Loader\FilesystemLoader( $paths ) );
$twigProfiler = new \Twig\Profiler\Profile();
$twig->addExtension( new ProfilerExtension( $twigProfiler ) );
$debugbar->addCollector( new \DebugBar\Bridge\TwigProfileCollector( $twigProfiler ) );

comxd avatar Dec 14 '19 05:12 comxd