Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00048a9

Browse files
committed
[DependencyInjection][AliasDeprecatedPublicServicesPass] Noop when the service is private
1 parent bf6e98c commit 00048a9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function process(ContainerBuilder $container)
5454

5555
$definition = $container->getDefinition($id);
5656
if (!$definition->isPublic() || $definition->isPrivate()) {
57-
throw new InvalidArgumentException(sprintf('The "%s" service is private: it cannot have the "%s" tag.', $id, $this->tagName));
57+
continue;
5858
}
5959

6060
$container

src/Symfony/Component/DependencyInjection/Tests/Compiler/AliasDeprecatedPublicServicesPassTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,13 @@ public function processWithMissingAttributeProvider()
5959

6060
public function testProcessWithNonPublicService()
6161
{
62-
$this->expectException(InvalidArgumentException::class);
63-
$this->expectExceptionMessage('The "foo" service is private: it cannot have the "container.private" tag.');
64-
6562
$container = new ContainerBuilder();
6663
$container
6764
->register('foo')
6865
->addTag('container.private', ['package' => 'foo/bar', 'version' => '1.2']);
6966

7067
(new AliasDeprecatedPublicServicesPass())->process($container);
68+
69+
$this->assertTrue($container->hasDefinition('foo'));
7170
}
7271
}

0 commit comments

Comments
 (0)