|
15 | 15 | use Doctrine\Common\Annotations\CachedReader;
|
16 | 16 | use Doctrine\Common\Annotations\PsrCachedReader;
|
17 | 17 | use Doctrine\Common\Annotations\Reader;
|
18 |
| -use Doctrine\Common\Cache\Psr6\DoctrineProvider; |
| 18 | +use Doctrine\Common\Cache\ArrayCache; |
19 | 19 | use Psr\Cache\CacheItemPoolInterface;
|
20 | 20 | use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
21 | 21 | use Symfony\Component\Validator\Context\ExecutionContextFactory;
|
@@ -429,22 +429,16 @@ private function createAnnotationReader(): Reader
|
429 | 429 | throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.');
|
430 | 430 | }
|
431 | 431 |
|
432 |
| - // Doctrine Annotation >= 1.13, Symfony Cache |
433 |
| - if (class_exists(PsrCachedReader::class) && class_exists(ArrayAdapter::class)) { |
| 432 | + if (class_exists(ArrayAdapter::class)) { |
434 | 433 | return new PsrCachedReader(new AnnotationReader(), new ArrayAdapter());
|
435 | 434 | }
|
436 | 435 |
|
437 |
| - // Doctrine Annotations < 1.13, Doctrine Cache >= 1.11, Symfony Cache |
438 |
| - if (class_exists(CachedReader::class) && class_exists(ArrayAdapter::class)) { |
439 |
| - return new CachedReader(new AnnotationReader(), DoctrineProvider::wrap(new ArrayAdapter())); |
440 |
| - } |
| 436 | + if (class_exists(CachedReader::class) && class_exists(ArrayCache::class)) { |
| 437 | + trigger_deprecation('symfony/validator', '5.4', 'Enabling annotation based constraint mapping without having symfony/cache installed is deprecated.'); |
441 | 438 |
|
442 |
| - // Doctrine Annotation >= 1.13, Doctrine Cache >= 2, no Symfony Cache |
443 |
| - if (class_exists(PsrCachedReader::class)) { |
444 |
| - throw new LogicException('Enabling annotation based constraint mapping requires the package symfony/cache to be installed.'); |
| 439 | + return new CachedReader(new AnnotationReader(), new ArrayCache()); |
445 | 440 | }
|
446 | 441 |
|
447 |
| - // Doctrine Annotation (<1.13 || >2), no Doctrine Cache, no Symfony Cache |
448 |
| - throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations (>=1.13) and symfony/cache to be installed.'); |
| 442 | + throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.'); |
449 | 443 | }
|
450 | 444 | }
|
0 commit comments