Closed
Description
Symfony version(s) affected
5.4.37-7.0.4
Description
Under certain circumstances, services can be incorrectly inlined in the compiled service container. This causes the error message:
The "App\Service1" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
This can be reproduced even when the entire application uses dependency injection and there is no direct use of the container.
The exact circumstances required aren't clear to me, but I've provided a fairly minimal reproduction repo below.
How to reproduce
I've created a repository to allow reproducing here: https://github.com/edsrzf/symfony-di-repro
Steps:
- Run
composer install
- Run
bin/console app:repro
Possible Solution
No response
Additional Context
As a workaround, affected service(s) can be made public.