Closed
Description
Symfony version(s) affected
6.2.* (and maybe other)
Description
A wrong Container is injected when using #[TaggedLocator('XXX')]
in an argument of a controller constructor
How to reproduce
add this controller
class AController extends AbstractController
{
public function __construct(
#[TaggedLocator('foobar')]
private readonly ContainerInterface $foo,
) {
}
#[Route('/', name: 'app_a')]
public function index(
): JsonResponse
{
dd($this->foo);
return $this->json([
'message' => 'Welcome to your new controller!',
'path' => 'src/Controller/AController.php',
]);
}
}
Possible Solution
We can work-arround this issue with the following constructor:
public function __construct(
#[TaggedLocator('foobar')]
- private readonly ContainerInterface $foo,
+ private readonly ServiceLocator $foo,
) {
}
but ...
Additional Context
I guess - there is a conflict with the "ServiceSubscriberInterface"