minor #23356 [TwigBundle] gracefully handle missing hinclude renderer (xabbuh)

This PR was merged into the 3.2 branch.

Discussion
----------

[TwigBundle] gracefully handle missing hinclude renderer

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Since #23272 the `ExtensionPass` from the TwigBundle will error when being used with FrameworkBundle 3.4 thus letting all `deps=high` build jobs fail.

Commits
-------

ebdbecfb8b gracefully handle missing hinclude renderer
This commit is contained in:
Fabien Potencier 2017-07-03 13:05:32 +03:00
commit 5d797b21a5

View File

@ -65,10 +65,7 @@ class ExtensionPass implements CompilerPassInterface
$container->getDefinition('twig.extension.httpkernel')->addTag('twig.extension');
// inject Twig in the hinclude service if Twig is the only registered templating engine
if (
!$container->hasParameter('templating.engines')
|| array('twig') == $container->getParameter('templating.engines')
) {
if ((!$container->hasParameter('templating.engines') || array('twig') == $container->getParameter('templating.engines')) && $container->hasDefinition('fragment.renderer.hinclude')) {
$container->getDefinition('fragment.renderer.hinclude')
->addTag('kernel.fragment_renderer', array('alias' => 'hinclude'))
->replaceArgument(0, new Reference('twig'))