You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
Let's say some bundle has several EventSubscriberInterface, and a configuration in place to conditionally enable some of them for some reason, how would you do that? That's the purpose of tags: decouple interfaces and wiring. This is desired.
thus, we have many cases where tags need to provide additional metadata for the wiring (only half of the core tags are compatible with autoconfiguration due to that I would say).
So I don't see any benefit about removing tags entirely.
Closing as tags serve a unique and legitimate purpose. The nice thing as you spotted, is that you can already save yourself from using them for simple (yet common) use cases.
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?
The text was updated successfully, but these errors were encountered: