Skip to content

Commit

Permalink
Merge pull request #781 from doctrine/5.0.x-merge-up-into-5.1.x_ukSuNM1L
Browse files Browse the repository at this point in the history
Merge release 5.0.1 into 5.1.x
  • Loading branch information
driehle authored Apr 23, 2022
2 parents 61dc078 + e8f405e commit 50d8be6
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 22 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
"predis/predis": "^1.1.10",
"vimeo/psalm": "^4.20.0"
},
"conflict": {
"doctrine/orm": "2.12.0"
},
"suggest": {
"doctrine/data-fixtures": "Data Fixtures if you want to generate test data or bootstrap data for your deployments"
},
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ parameters:
- src
- tests
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/jangregor/phpstan-prophecy/extension.neon
3 changes: 0 additions & 3 deletions src/Form/Element/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use function current;
use function get_class;
use function gettype;
use function interface_exists;
use function is_callable;
use function is_object;
use function is_string;
Expand Down Expand Up @@ -594,5 +593,3 @@ protected function loadValueOptions(): void
$this->valueOptions = $options;
}
}

interface_exists(ObjectManager::class);
4 changes: 0 additions & 4 deletions src/Options/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Laminas\Stdlib\AbstractOptions;

use function gettype;
use function interface_exists;
use function is_callable;
use function is_string;
use function sprintf;
Expand Down Expand Up @@ -256,6 +255,3 @@ public function setStorage($storage): void
$this->storage = $storage;
}
}

interface_exists(ClassMetadata::class);
interface_exists(ObjectRepository::class);
4 changes: 0 additions & 4 deletions src/Persistence/ObjectManagerAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Doctrine\Persistence\ObjectManager;

use function interface_exists;

interface ObjectManagerAwareInterface
{
/**
Expand All @@ -20,5 +18,3 @@ public function setObjectManager(ObjectManager $objectManager): void;
*/
public function getObjectManager(): ObjectManager;
}

interface_exists(ObjectManager::class);
4 changes: 0 additions & 4 deletions src/Persistence/ProvidesObjectManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Doctrine\Persistence\ObjectManager;

use function interface_exists;

/**
* Trait to provide object manager to a form (only works from PHP 5.4)
*/
Expand All @@ -31,5 +29,3 @@ public function getObjectManager(): ObjectManager
return $this->objectManager;
}
}

interface_exists(ObjectManager::class);
3 changes: 0 additions & 3 deletions src/Service/DriverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

use function class_exists;
use function get_class;
use function interface_exists;
use function is_subclass_of;
use function sprintf;

Expand Down Expand Up @@ -128,5 +127,3 @@ protected function createDriver(ContainerInterface $container, Driver $options):
return $driver;
}
}

interface_exists(MappingDriver::class);
4 changes: 0 additions & 4 deletions src/Validator/Service/AbstractValidatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Laminas\Stdlib\ArrayUtils;

use function class_exists;
use function interface_exists;
use function is_string;
use function sprintf;

Expand Down Expand Up @@ -98,6 +97,3 @@ protected function merge(array $previousOptions, array $newOptions): array
return ArrayUtils::merge($previousOptions, $newOptions, true);
}
}

interface_exists(ObjectManager::class);
interface_exists(ObjectRepository::class);
27 changes: 27 additions & 0 deletions tests/Service/DriverFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace DoctrineModuleTest\Service;

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use DoctrineModule\Service\DriverFactory;
Expand Down Expand Up @@ -90,4 +93,28 @@ public function testCreateAttributeDriver(): void
$driver = $factory->__invoke($serviceManager, AttributeDriver::class);
$this->assertInstanceOf(AttributeDriver::class, $driver);
}

public function testCreateAnnotationDriver(): void
{
$serviceManager = new ServiceManager();
$serviceManager->setService(
'config',
[
'doctrine' => [
'driver' => [
'testDriver' => ['class' => AnnotationDriver::class],
],
],
]
);
$serviceManager->setService(
'doctrine.cache.array',
new ArrayCache()
);

$factory = new DriverFactory('testDriver');
$driver = $factory->__invoke($serviceManager, AnnotationDriver::class);
$this->assertInstanceOf(AnnotationDriver::class, $driver);
$this->assertInstanceOf(Reader::class, $driver->getReader());
}
}

0 comments on commit 50d8be6

Please sign in to comment.