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
Trying to inject AnnotationReader $reader in a service with `arguments: ['@annotation_reader'] worked fine in Symfony 3.2.3 but since upgrading to 3.2.4 it fails with:
construct() must be an instance of Doctrine\Common\Annotations\AnnotationReader, instance of Doctrine\Common\Annotations\CachedReader given
Might be worth mentioning that I am trying to inject it in an EventListener:
That's a bug in your type hints: you should type hint against the interface, not against the implementation. Reader is the interface - and there are two implemetations: AnnotationReader and CachedReader.
you should typehint the Doctrine interface (i.e. \Doctrine\Common\Annotations\Reader), not the Doctrine implementation. Otherwise, you forbid using the cached implementation.
Btw, 3.2.2 and older were also using the cached version. Using the uncached implementation is a bug introduced in 3.2.3 (and with a huge impact on performance)
closing this issue because the actual issue is not in Symfony (and we will not reintroduce the performance regression for people starting to rely on the bug introduced in a single release)
Trying to inject
AnnotationReader $reader
in a service with `arguments: ['@annotation_reader'] worked fine in Symfony 3.2.3 but since upgrading to 3.2.4 it fails with:Might be worth mentioning that I am trying to inject it in an EventListener:
This is probably caused by: #21556
The text was updated successfully, but these errors were encountered: