Skip to content

Commit 4a0d31c

Browse files
dunglasfabpot
authored andcommitted
[Console] Fix BC break introduced by #18101
1 parent ed73ac3 commit 4a0d31c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

DependencyInjection/Compiler/AddConsoleCommandPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function process(ContainerBuilder $container)
3838
throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id));
3939
}
4040
$container->setAlias($serviceId = 'console.command.'.strtolower(str_replace('\\', '_', $class)), $id);
41-
$serviceIds[] = $serviceId;
41+
$serviceIds[] = $definition->isPublic() ? $id : $serviceId;
4242
}
4343

4444
$container->setParameter('console.command.ids', $serviceIds);

Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public function testProcess($public)
4545
$this->assertTrue($container->hasDefinition($alias));
4646
}
4747

48+
$id = $public ? 'my-command' : 'console.command.symfony_bundle_frameworkbundle_tests_dependencyinjection_compiler_mycommand';
4849
$this->assertTrue($container->hasParameter('console.command.ids'));
49-
$this->assertSame(array('console.command.symfony_bundle_frameworkbundle_tests_dependencyinjection_compiler_mycommand'), $container->getParameter('console.command.ids'));
50+
$this->assertSame(array($id), $container->getParameter('console.command.ids'));
5051
}
5152

5253
public function visibilityProvider()

0 commit comments

Comments
 (0)