Skip to content

[RFC][DI] Get rid of tags #24432

Closed
Closed
@Vinorcola

Description

@Vinorcola
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version ?

I was wondering, seing autoconfiguration system and the following pull requests:

if we could consider a futur without tags, tags simply being replaced by "instanceof".

Indeed, autoconfigure tends to add tags to classes implementing a certain type in order to inject them into another service. But rather than tagging according to implementations and then fetching tagged services, why do we not simply fetch services according to their implementation directly?

This would also bring more security has tagged services will have to implement a certain type (which you probably often want). And for those special cases where you want to tag different classes, you can just create an empty interface and make your services implement that empty interface.

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions