55namespace Dot \AnnotatedServices \Factory ;
66
77use Doctrine \Common \Annotations \AnnotationReader ;
8- use Doctrine \Common \Annotations \AnnotationRegistry ;
9- use Doctrine \Common \Annotations \CachedReader ;
8+ use Doctrine \Common \Annotations \PsrCachedReader ;
109use Doctrine \Common \Annotations \Reader ;
11- use Doctrine \ Common \ Cache \Cache ;
10+ use Psr \ Cache \CacheItemPoolInterface ;
1211use Psr \Container \ContainerExceptionInterface ;
1312use Psr \Container \ContainerInterface ;
1413use Psr \Container \NotFoundExceptionInterface ;
1514
1615abstract class AbstractAnnotatedFactory
1716{
18- public const CACHE_SERVICE = ' Dot\AnnotatedServices\Cache ' ;
17+ public const CACHE_SERVICE = CacheItemPoolInterface::class ;
1918 protected ?Reader $ annotationReader = null ;
2019 public function setAnnotationReader (Reader $ annotationReader ): void
2120 {
@@ -32,12 +31,10 @@ protected function createAnnotationReader(ContainerInterface $container): Reader
3231 return $ this ->annotationReader ;
3332 }
3433
35- AnnotationRegistry::registerLoader ('class_exists ' );
36-
3734 if (! $ container ->has (self ::CACHE_SERVICE )) {
3835 return $ this ->annotationReader = new AnnotationReader ();
3936 } else {
40- /** @var Cache $cache */
37+ /** @var CacheItemPoolInterface $cache */
4138 $ cache = $ container ->get (self ::CACHE_SERVICE );
4239 $ debug = false ;
4340 if ($ container ->has ('config ' )) {
@@ -46,7 +43,7 @@ protected function createAnnotationReader(ContainerInterface $container): Reader
4643 $ debug = (bool ) $ config ['debug ' ];
4744 }
4845 }
49- return $ this ->annotationReader = new CachedReader (new AnnotationReader (), $ cache , $ debug );
46+ return $ this ->annotationReader = new PsrCachedReader (new AnnotationReader (), $ cache , $ debug );
5047 }
5148 }
5249}
0 commit comments