Skip to content

Commit e3d1e90

Browse files
[FrameworkBundle] acces public-deprecated services via the private container to remove false-positive deprecations
1 parent 89bb40c commit e3d1e90

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

DependencyInjection/AddConsoleCommandPass.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ class AddConsoleCommandPass implements CompilerPassInterface
2929
private $commandLoaderServiceId;
3030
private $commandTag;
3131
private $noPreloadTag;
32+
private $privateTagName;
3233

33-
public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload')
34+
public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload', string $privateTagName = 'container.private')
3435
{
3536
$this->commandLoaderServiceId = $commandLoaderServiceId;
3637
$this->commandTag = $commandTag;
3738
$this->noPreloadTag = $noPreloadTag;
39+
$this->privateTagName = $privateTagName;
3840
}
3941

4042
public function process(ContainerBuilder $container)
@@ -62,7 +64,7 @@ public function process(ContainerBuilder $container)
6264
}
6365

6466
if (null === $commandName) {
65-
if (!$definition->isPublic() || $definition->isPrivate()) {
67+
if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) {
6668
$commandId = 'console.command.public_alias.'.$id;
6769
$container->setAlias($commandId, $id)->setPublic(true);
6870
$id = $commandId;

0 commit comments

Comments
 (0)