10000 bug #43801 [TwigBundle] fix auto-enabling assets/expression/routing/y… · symfony/symfony@66fcfba · GitHub
[go: up one dir, main page]

Skip to content

Commit 66fcfba

Browse files
bug #43801 [TwigBundle] fix auto-enabling assets/expression/routing/yaml/workflow extensions (nicolas-grekas)
This PR was merged into the 5.3 branch. Discussion ---------- [TwigBundle] fix auto-enabling assets/expression/routing/yaml/workflow extensions | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41672 | License | MIT | Doc PR | - Since there is no config option to force-enable those extension, we cannot register them conditionally using `$container::willBeAvailable()`. (As a general rule of thumb, `$container::willBeAvailable()` should not be used in a compiler pass.) Commits ------- bd8256d [TwigBundle] fix auto-enabling assets/expression/routing/yaml/workflow extensions
2 parents c2ecdc6 + bd8256d commit 66fcfba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ class ExtensionPass implements CompilerPassInterface
2727
{
2828
public function process(ContainerBuilder $container)
2929
{
30-
if (!$container::willBeAvailable('symfony/asset', Packages::class, ['symfony/twig-bundle'])) {
30+
if (!class_exists(Packages::class)) {
3131
$container->removeDefinition('twig.extension.assets');
3232
}
3333

34-
if (!$container::willBeAvailable('symfony/expression-language', Expression::class, ['symfony/twig-bundle'])) {
34+
if (!class_exists(Expression::class)) {
3535
$container->removeDefinition('twig.extension.expression');
3636
}
3737

38-
if (!$container::willBeAvailable('symfony/routing', UrlGeneratorInterface::class, ['symfony/twig-bundle'])) {
38+
if (!interface_exists(UrlGeneratorInterface::class)) {
3939
$container->removeDefinition('twig.extension.routing');
4040
}
4141

42-
if (!$container::willBeAvailable('symfony/yaml', Yaml::class, ['symfony/twig-bundle'])) {
42+
if (!class_exists(Yaml::class)) {
4343
$container->removeDefinition('twig.extension.yaml');
4444
}
4545

@@ -115,7 +115,7 @@ public function process(ContainerBuilder $container)
115115
$container->getDefinition('twig.extension.expression')->addTag('twig.extension');
116116
}
117117

118-
if (!$container::willBeAvailable('symfony/workflow', Workflow::class, ['symfony/twig-bundle']) || !$container->has('workflow.registry')) {
118+
if (!class_exists(Workflow::class) || !$container->has('workflow.registry')) {
119119
$container->removeDefinition('workflow.twig_extension');
120120
} else {
121121
$container->getDefinition('workflow.twig_extension')->addTag('twig.extension');

0 commit comments

Comments
 (0)
0