Closed
Description
Symfony version(s) affected
v5.4.16
Description
Symfony v5.1.16 has introduced a BC break in how autoconfiguring works. The issue was caused by #48027 .
How to reproduce
#[AutoconfigureTag('app.foo')]
interface FooInterface
{
}
#[AutoconfigureTag('app.foo', ['alias' => 'bar'])]
class Foo implements FooInterface
{
}
app.foo_locator:
class: Symfony\Component\DependencyInjection\ServiceLocator
arguments: [ !tagged_iterator { tag: 'app.foo', index_by: 'alias' } ]
Before #48027 the app.foo_locator
service locator would have 2 aliases for the Foo
service (which is the behavior I need):
return $container->services['app.foo_locator'] = new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($container->getService, [
'App\\Service\\Foo' => ['privates', 'App\\Service\\Foo', 'getFooService', true],
'bar' => ['privates', 'App\\Service\\Foo', 'getFooService', true],
], [
'App\\Service\\Foo' => 'App\\Service\\Foo',
'bar' => 'App\\Service\\Foo',
]);
After upgrading to v5.4.16, this is no longer the case:
return $container->services['app.foo_locator'] = new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($container->getService, [
'bar' => ['privates', 'App\\Service\\Foo', 'getFooService', true],
], [
'bar' => 'App\\Service\\Foo',
]);
Since the Foo
service has an #[AutoconfigureTag]
attribute, the FooInterface
is skipped during autoconfiguration.
Possible Solution
No response
Additional Context
No response