[DependencyInjection][AliasDeprecatedPublicServicesPass] Noop when the service is private
This commit is contained in:
parent
bf6e98c220
commit
00048a9c73
@ -54,7 +54,7 @@ final class AliasDeprecatedPublicServicesPass extends AbstractRecursivePass
|
||||
|
||||
$definition = $container->getDefinition($id);
|
||||
if (!$definition->isPublic() || $definition->isPrivate()) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" service is private: it cannot have the "%s" tag.', $id, $this->tagName));
|
||||
continue;
|
||||
}
|
||||
|
||||
$container
|
||||
|
@ -59,14 +59,13 @@ final class AliasDeprecatedPublicServicesPassTest extends TestCase
|
||||
|
||||
public function testProcessWithNonPublicService()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The "foo" service is private: it cannot have the "container.private" tag.');
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container
|
||||
->register('foo')
|
||||
->addTag('container.private', ['package' => 'foo/bar', 'version' => '1.2']);
|
||||
|
||||
(new AliasDeprecatedPublicServicesPass())->process($container);
|
||||
|
||||
$this->assertTrue($container->hasDefinition('foo'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user