Description
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:
- Have a common way to collect services and inject it into a single one #12269
- [DI] Tag subscribers for collecting tagged services? #22649
- [DI] Inject all services with a specific tag #23916
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?