Skip to content

Commit

Permalink
Update cache in tests to use PSR-6
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 7, 2024
1 parent 69e422e commit 1860a9c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 18 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"doctrine/persistence": "<1.3"
},
"require-dev": {
"cache/array-adapter": "^1.1",
"composer/semver": "^3.3.2",
"doctrine/annotations": "^1.11 || ^2.0",
"doctrine/collections": "^1.6 || ^2.1",
Expand Down
5 changes: 2 additions & 3 deletions tests/DoctrineIntegration/ODM/document-manager.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?php declare(strict_types = 1);

use Cache\Adapter\PHPArray\ArrayCachePool;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ODM\MongoDB\Configuration;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\DoctrineProvider;

$config = new Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('PHPstan\Doctrine\OdmProxies');
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
$config->setMetadataCache(new ArrayCachePool());
$config->setHydratorDir(__DIR__);
$config->setHydratorNamespace('PHPstan\Doctrine\OdmHydrators');

Expand Down
5 changes: 2 additions & 3 deletions tests/DoctrineIntegration/ORM/entity-manager.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?php declare(strict_types = 1);

use Cache\Adapter\PHPArray\ArrayCachePool;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\DoctrineProvider;

$config = new Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
$config->setMetadataCache(new ArrayCachePool());

$config->setMetadataDriverImpl(
new AnnotationDriver(
Expand Down
5 changes: 2 additions & 3 deletions tests/Rules/DeadCode/entity-manager.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php declare(strict_types = 1);

use Cache\Adapter\PHPArray\ArrayCachePool;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\DoctrineProvider;

$config = new Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
$config->setMetadataCache(new ArrayCachePool());

$metadataDriver = new MappingDriverChain();
$metadataDriver->addDriver(new AnnotationDriver(
Expand Down
5 changes: 2 additions & 3 deletions tests/Rules/Doctrine/ORM/entity-manager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php declare(strict_types = 1);

use Cache\Adapter\PHPArray\ArrayCachePool;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\DBAL\Types\DateTimeImmutableType;
use Doctrine\DBAL\Types\Type;
Expand All @@ -8,13 +9,11 @@
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\DoctrineProvider;

$config = new Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
$config->setMetadataCache(new ArrayCachePool());

$metadataDriver = new MappingDriverChain();
$metadataDriver->addDriver(new AnnotationDriver(
Expand Down
5 changes: 2 additions & 3 deletions tests/Rules/Properties/entity-manager.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php declare(strict_types = 1);

use Cache\Adapter\PHPArray\ArrayCachePool;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\DoctrineProvider;

$config = new Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
$config->setMetadataCache(new ArrayCachePool());

$metadataDriver = new MappingDriverChain();
$metadataDriver->addDriver(new AnnotationDriver(
Expand Down
5 changes: 2 additions & 3 deletions tests/Type/Doctrine/data/QueryResult/entity-manager.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?php declare(strict_types = 1);

use Cache\Adapter\PHPArray\ArrayCachePool;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\DoctrineProvider;

$config = new Configuration();
$config->setProxyDir(__DIR__);
$config->setProxyNamespace('PHPstan\Doctrine\OrmProxies');
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
$config->setMetadataCache(new ArrayCachePool());

$metadataDriver = new MappingDriverChain();

Expand Down

0 comments on commit 1860a9c

Please sign in to comment.