Skip to content

Commit eab90ef

Browse files
committed
modify definitions only if the do exist
If the `TranslatorPass` is used an application without the Console component, the commands will not be registered. Thus, their service definitions must not be modified.
1 parent a19d1e5 commit eab90ef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,15 @@ public function process(ContainerBuilder $container)
8080
->replaceArgument(3, $loaders)
8181
;
8282

83-
if ($container->hasParameter('twig.default_path')) {
83+
if (!$container->hasParameter('twig.default_path')) {
84+
return;
85+
}
86+
87+
if ($container->hasDefinition($this->debugCommandServiceId)) {
8488
$container->getDefinition($this->debugCommandServiceId)->replaceArgument(4, $container->getParameter('twig.default_path'));
89+
}
90+
91+
if ($container->hasDefinition($this->updateCommandServiceId)) {
8592
$container->getDefinition($this->updateCommandServiceId)->replaceArgument(5, $container->getParameter('twig.default_path'));
8693
}
8794
}

0 commit comments

Comments
 (0)