Commit 1a0b1e11 authored by Fabien Potencier's avatar Fabien Potencier

bug #1511 Fix deprecation notice with symfony/twig-bridge 3.2+ in TwigServiceProvider (skalpa)

This PR was merged into the 2.1.x-dev branch.

Discussion
----------

Fix deprecation notice with symfony/twig-bridge 3.2+ in TwigServiceProvider

Fixes the deprecation triggered when instantiating `FormExtension` twig-bridge with 3.2+.

I check for the existence of `Symfony\Bridge\Twig\Extension\HttpKernelRuntime` to determine if we're using 3.2 as it was added in 3.2.0-beta1.

Commits
-------

6615118d Fix deprecation notice with symfony/twig-bridge 3.2+ in TwigServiceProvider
parents 1b2f0394 6615118d
......@@ -109,7 +109,7 @@ class TwigServiceProvider implements ServiceProviderInterface
return new TwigRenderer($app['twig.form.engine'], $csrfTokenManager);
};
$twig->addExtension(new FormExtension($app['twig.form.renderer']));
$twig->addExtension(new FormExtension(class_exists(HttpKernelRuntime::class) ? null : $app['twig.form.renderer']));
// add loader for Symfony built-in form templates
$reflected = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment