Skip to content

Commit 5a8b4c1

Browse files
committed
Fix setMetadataCacheImpl
1 parent 6897869 commit 5a8b4c1

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"phpstan/phpstan-phpunit": "^1.0",
3131
"phpstan/phpstan-strict-rules": "^1.0",
3232
"phpunit/phpunit": "^9.5",
33-
"ramsey/uuid-doctrine": "^1.5.0"
33+
"ramsey/uuid-doctrine": "^1.5.0",
34+
"symfony/cache": "^4.4.35"
3435
},
3536
"config": {
3637
"platform": {

tests/DoctrineIntegration/ODM/document-manager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php declare(strict_types = 1);
22

33
use Doctrine\Common\Annotations\AnnotationReader;
4-
use Doctrine\Common\Cache\ArrayCache;
54
use Doctrine\ODM\MongoDB\Configuration;
65
use Doctrine\ODM\MongoDB\DocumentManager;
76
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
7+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
8+
use Symfony\Component\Cache\DoctrineProvider;
89

910
$config = new Configuration();
1011
$config->setProxyDir(__DIR__);
1112
$config->setProxyNamespace('PHPstan\Doctrine\OdmProxies');
12-
$config->setMetadataCacheImpl(new ArrayCache());
13+
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
1314
$config->setHydratorDir(__DIR__);
1415
$config->setHydratorNamespace('PHPstan\Doctrine\OdmHydrators');
1516

tests/DoctrineIntegration/ORM/entity-manager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php declare(strict_types = 1);
22

33
use Doctrine\Common\Annotations\AnnotationReader;
4-
use Doctrine\Common\Cache\ArrayCache;
54
use Doctrine\ORM\Configuration;
65
use Doctrine\ORM\EntityManager;
76
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
7+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
8+
use Symfony\Component\Cache\DoctrineProvider;
89

910
$config = new Configuration();
1011
$config->setProxyDir(__DIR__);
1112
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
12-
$config->setMetadataCacheImpl(new ArrayCache());
13+
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
1314

1415
$config->setMetadataDriverImpl(
1516
new AnnotationDriver(

tests/Rules/Doctrine/ORM/entity-manager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php declare(strict_types = 1);
22

33
use Doctrine\Common\Annotations\AnnotationReader;
4-
use Doctrine\Common\Cache\ArrayCache;
54
use Doctrine\ORM\Configuration;
65
use Doctrine\ORM\EntityManager;
76
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
7+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
8+
use Symfony\Component\Cache\DoctrineProvider;
89

910
$config = new Configuration();
1011
$config->setProxyDir(__DIR__);
1112
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
12-
$config->setMetadataCacheImpl(new ArrayCache());
13+
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
1314

1415
$config->setMetadataDriverImpl(
1516
new AnnotationDriver(

0 commit comments

Comments
 (0)