Skip to content

Service decoration resolution should mark the alias it creates a wanna-be-private for services tagged as container.private #47408

Closed
@stof

Description

@stof

Symfony version(s) affected

5.4

Description

Accessing the validator service from the TestContainer triggers a deprecation while it should still be allowed.

How to reproduce

Create a test that accesses the validator service from the TestContainer.

This triggers a deprecation that accessing validator from the container is deprecated and DI should be used instead. But TestContainer is precisely meant to allow allow accessing private services.

The issue is that validator has the tag container.private which would add it in the test service locator, but it is decorated by debug.validator (the TraceableValidator), which looses that condition. And so the validator id is not added in the private test locator.

However, as this wanna-be-private is now handled with tags, I'm not sure we actually have a way to mark an alias as becoming private in the future.

Possible Solution

No response

Additional Context

No response

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