|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;
|
13 | 13 |
|
| 14 | +use Symfony\Component\Config\Resource\ClassExistenceResource; |
14 | 15 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
15 | 16 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
16 | 17 | use Symfony\Component\DependencyInjection\Reference;
|
| 18 | +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; |
| 19 | +use Symfony\Component\Stopwatch\Stopwatch; |
| 20 | +use Symfony\Component\Yaml\Parser as YamlParser; |
17 | 21 |
|
18 | 22 | /**
|
19 | 23 | * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
@@ -72,15 +76,18 @@ public function process(ContainerBuilder $container)
|
72 | 76 | $container->getDefinition('twig.extension.assets')->addTag('twig.extension');
|
73 | 77 | }
|
74 | 78 |
|
75 |
| - if (class_exists('Symfony\Component\Yaml\Parser')) { |
| 79 | + $container->addResource(new ClassExistenceResource(YamlParser::class)); |
| 80 | + if (class_exists(YamlParser::class)) { |
76 | 81 | $container->getDefinition('twig.extension.yaml')->addTag('twig.extension');
|
77 | 82 | }
|
78 | 83 |
|
79 |
| - if (class_exists('Symfony\Component\Stopwatch\Stopwatch')) { |
| 84 | + $container->addResource(new ClassExistenceResource(Stopwatch::class)); |
| 85 | + if (class_exists(Stopwatch::class)) { |
80 | 86 | $container->getDefinition('twig.extension.debug.stopwatch')->addTag('twig.extension');
|
81 | 87 | }
|
82 | 88 |
|
83 |
| - if (class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { |
| 89 | + $container->addResource(new ClassExistenceResource(ExpressionLanguage::class)); |
| 90 | + if (class_exists(ExpressionLanguage::class)) { |
84 | 91 | $container->getDefinition('twig.extension.expression')->addTag('twig.extension');
|
85 | 92 | }
|
86 | 93 | }
|
|
0 commit comments