Skip to content

Commit 3f8a09d

Browse files
authored
Merge pull request #28 from dotkernel/issue-27
Issue 27
2 parents f6981dd + 938720c commit 3f8a09d

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DotKernel component used to create services through [Laminas Service Manager](ht
55
This package can clean up your code, by getting rid of all the factories you write, sometimes just to inject a dependency or two.
66

77
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-annotated-services)
8-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.1.4)
8+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.1.5)
99

1010
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/issues)
1111
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/network)

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
],
2222
"require": {
2323
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
24-
"laminas/laminas-servicemanager": "^3.10",
25-
"doctrine/annotations": "^1.13",
26-
"doctrine/cache": "^1.13",
27-
"doctrine/orm" : "^2.11"
24+
"laminas/laminas-servicemanager": "^3.22.1",
25+
"doctrine/annotations": "^2.0.1",
26+
"doctrine/cache": "^2.2.0",
27+
"doctrine/orm" : "^2.17.3"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^10.2",
31-
"vimeo/psalm": "^5.13",
30+
"phpunit/phpunit": "^10.5.9",
31+
"vimeo/psalm": "^5.20",
3232
"laminas/laminas-coding-standard": "^2.5"
3333
},
3434
"autoload": {

src/Factory/AbstractAnnotatedFactory.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
namespace Dot\AnnotatedServices\Factory;
66

77
use Doctrine\Common\Annotations\AnnotationReader;
8-
use Doctrine\Common\Annotations\AnnotationRegistry;
9-
use Doctrine\Common\Annotations\CachedReader;
8+
use Doctrine\Common\Annotations\PsrCachedReader;
109
use Doctrine\Common\Annotations\Reader;
11-
use Doctrine\Common\Cache\Cache;
10+
use Psr\Cache\CacheItemPoolInterface;
1211
use Psr\Container\ContainerExceptionInterface;
1312
use Psr\Container\ContainerInterface;
1413
use Psr\Container\NotFoundExceptionInterface;
1514

1615
abstract 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

Comments
 (0)