bug #34715 [TwigBundle] remove service when base class is missing (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[TwigBundle] remove service when base class is missing

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

c3a658ac0f remove service when base class is missing
This commit is contained in:
Fabien Potencier 2019-11-30 13:44:40 +01:00
commit b357488e77

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;
use Symfony\Bridge\Twig\Extension\AssetExtension;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -119,6 +120,10 @@ class ExtensionPass implements CompilerPassInterface
$loader = $container->getDefinition('twig.loader.filesystem');
$loader->setMethodCalls(array_merge($twigLoader->getMethodCalls(), $loader->getMethodCalls()));
if (!method_exists(AssetExtension::class, 'getName')) {
$container->removeDefinition('templating.engine.twig');
}
$twigLoader->clearTag('twig.loader');
} else {
$container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false));