Skip to content

[DependencyInjection] Service incorrectly inlined #54294

Closed
@edsrzf

Description

@edsrzf

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions