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
Named Serializes are only injected when using SerializerInterface. When I use an intersection type like SerializerInterface&DenormalizerInterface I'm getting the default Serializer.
Recommendation: use the #[Target] attribute instead of relying on matching by name when you expect a non-default service. This way, you will get an explicit failure instead of a silent fallback to the default one, as Symfony will know that you expect to target a specific implementation thanks to the attribute (it cannot make such assumption based on the usage of a name for the argument, as all arguments have a name)
Symfony version(s) affected
7.3.0, 7.2.0
Description
Named Serializes are only injected when using
SerializerInterface
. When I use an intersection type likeSerializerInterface&DenormalizerInterface
I'm getting the defaultSerializer
.How to reproduce
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: