[TwigBundle] removed Stopwatch Twig extension when the Stopwatch component is not available

This commit is contained in:
Fabien Potencier 2016-09-29 15:22:06 -07:00
parent d0792e454e
commit 3d4ad0b084
2 changed files with 4 additions and 1 deletions

View File

@ -75,5 +75,9 @@ class ExtensionPass implements CompilerPassInterface
if (class_exists('Symfony\Component\Yaml\Parser')) {
$container->getDefinition('twig.extension.yaml')->addTag('twig.extension');
}
if (class_exists('Symfony\Component\Stopwatch\Stopwatch')) {
$container->getDefinition('twig.extension.debug.stopwatch')->addTag('twig.extension');
}
}
}

View File

@ -98,7 +98,6 @@
<service id="twig.extension.yaml" class="Symfony\Bridge\Twig\Extension\YamlExtension" public="false" />
<service id="twig.extension.debug.stopwatch" class="Symfony\Bridge\Twig\Extension\StopwatchExtension" public="false">
<tag name="twig.extension" />
<argument type="service" id="debug.stopwatch" on-invalid="ignore" />
<argument>%kernel.debug%</argument>
</service>