diff --git a/composer.json b/composer.json index 0747d096..fa5b4fe4 100644 --- a/composer.json +++ b/composer.json @@ -63,16 +63,16 @@ }, "require-dev": { "doctrine/coding-standard": "^12.0.0", - "doctrine/mongodb-odm": "^2.5.0", - "doctrine/orm": "^2.13.4", - "jangregor/phpstan-prophecy": "^1.0.0", - "laminas/laminas-i18n": "^2.17.0", - "laminas/laminas-log": "^2.15.3", - "laminas/laminas-serializer": "^2.13.0", - "laminas/laminas-session": "^2.13.0", + "doctrine/mongodb-odm": "^2.7.1", + "doctrine/orm": "^2.20.1", + "jangregor/phpstan-prophecy": "^2", + "laminas/laminas-i18n": "^2.29.0", + "laminas/laminas-log": "^2.17.1", + "laminas/laminas-serializer": "^2.17.0", + "laminas/laminas-session": "^2.22.1", "phpdocumentor/guides-cli": "^1.5.0", - "phpstan/phpstan": "^1.9.2", - "phpstan/phpstan-phpunit": "^1.3.0", + "phpstan/phpstan": "^2.0.4", + "phpstan/phpstan-phpunit": "^2.0.3", "phpunit/phpunit": "^10.5.40", "predis/predis": "^1.1.10" }, diff --git a/phpstan.neon b/phpstan.neon index 12ac6ff9..89e3e49d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,10 +1,14 @@ parameters: level: 6 - checkGenericClassInNonGenericObjectType: false + treatPhpDocTypesAsCertain: false paths: - src - tests ignoreErrors: + - + identifier: missingType.generics + - + identifier: method.alreadyNarrowedType - message: '#internal(G|S)etItem\(\) has parameter \$(casToken|value) with no type specified#' path: src/Cache/DoctrineCacheStorage.php diff --git a/src/Cache/DoctrineCacheStorage.php b/src/Cache/DoctrineCacheStorage.php index c1304b68..e4bfcc1d 100644 --- a/src/Cache/DoctrineCacheStorage.php +++ b/src/Cache/DoctrineCacheStorage.php @@ -28,6 +28,8 @@ public function __construct($options, protected Cache $cache) /** * {@inheritDoc} + * + * @param-out bool $success */ protected function internalGetItem(&$normalizedKey, &$success = null, &$casToken = null) { diff --git a/tests/Form/Element/ProxyTest.php b/tests/Form/Element/ProxyTest.php index 1eed7897..d49736f4 100644 --- a/tests/Form/Element/ProxyTest.php +++ b/tests/Form/Element/ProxyTest.php @@ -19,8 +19,6 @@ use function array_shift; use function func_get_args; -use const PHP_VERSION_ID; - /** * Tests for the Collection pagination adapter * @@ -279,9 +277,7 @@ public function testExceptionThrownForNonCallableLabelGenerator(): void 'TypeError', ); $this->expectExceptionMessage( - PHP_VERSION_ID >= 80000 - ? 'DoctrineModule\Form\Element\Proxy::setLabelGenerator(): Argument #1 ($callable) must be of type callable' - : 'Argument 1 passed to DoctrineModule\Form\Element\Proxy::setLabelGenerator() must be callable', + 'DoctrineModule\Form\Element\Proxy::setLabelGenerator(): Argument #1 ($callable) must be of type callable', ); $this->proxy->setOptions(['label_generator' => 'I throw an invalid type error']); diff --git a/tests/Persistence/ProvidesObjectManagerTest.php b/tests/Persistence/ProvidesObjectManagerTest.php new file mode 100644 index 00000000..89b1b458 --- /dev/null +++ b/tests/Persistence/ProvidesObjectManagerTest.php @@ -0,0 +1,25 @@ +createMock(ObjectManager::class); + $dummy = new DummyObjectManagerProvider(); + $dummy->setObjectManager($objectManager); + $retrieved = $dummy->getObjectManager(); + + $this->assertSame($objectManager, $retrieved); + } +} diff --git a/tests/Persistence/TestAsset/DummyObjectManagerProvider.php b/tests/Persistence/TestAsset/DummyObjectManagerProvider.php new file mode 100644 index 00000000..43b8f555 --- /dev/null +++ b/tests/Persistence/TestAsset/DummyObjectManagerProvider.php @@ -0,0 +1,12 @@ +__invoke($serviceManager, MappingDriverChain::class); $this->assertInstanceOf(MappingDriverChain::class, $driver); - assert($driver instanceof MappingDriverChain); $drivers = $driver->getDrivers(); $this->assertCount(1, $drivers);