Skip to content

[DI] confusing deprecation in TypedReference in 4.4 #35752

Closed
@linaori

Description

@linaori

In #26636 (4.1) the $requiringClass argument in TypedReference has been deprecated: https://github.com/symfony/symfony/pull/26636/files#diff-6561cf4254b86cdc43ada0985f87e4a4R29

While helping someone on Slack whom received this deprecation, we had a hard time figuring out what the actual issue was. As $requiringClass is removed, the deprecation is referencing to a non-existing argument. I was thinking about something shown below as alternative, though I'm not 100% sure about it.

public function __construct(string $id, string $type, /* $requiringClass, */ $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name = null)

With as message:

The $requiringClass argument of "%s()" is deprecated since Symfony 4.1. All existing arguments should move 1 position to the left.

Edit: can make a PR based on this change: f473c24

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)DependencyInjection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions