From 1180679ecb783374ca7fc6665068a9dc25472eb8 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 19 Jun 2024 11:32:20 +0200 Subject: [PATCH] Bump rector (#851) --- composer.json | 2 +- psalm.xml | 3 +++ src/Model/ModelManager.php | 2 +- tests/Model/ModelManagerTest.php | 6 ++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 4beefd1a..0ac2569a 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "phpunit/phpunit": "^9.6", "psalm/plugin-phpunit": "^0.18", "psalm/plugin-symfony": "^5.0", - "rector/rector": "^0.19", + "rector/rector": "^1.1", "sonata-project/block-bundle": "^4.2 || ^5.0", "symfony/browser-kit": "^5.4 || ^6.2 || ^7.0", "symfony/css-selector": "^5.4 || ^6.2 || ^7.0", diff --git a/psalm.xml b/psalm.xml index bdf760eb..fc8674a1 100644 --- a/psalm.xml +++ b/psalm.xml @@ -11,4 +11,7 @@ + + + diff --git a/src/Model/ModelManager.php b/src/Model/ModelManager.php index 6f9b3a89..dc3c5cd6 100755 --- a/src/Model/ModelManager.php +++ b/src/Model/ModelManager.php @@ -191,7 +191,7 @@ public function getIdentifierValues(object $model): array public function getIdentifierFieldNames(string $class): array { - return array_filter($this->getMetadata($class)->getIdentifier()); + return array_filter($this->getMetadata($class)->getIdentifier(), static fn (?string $id) => null !== $id); } public function getNormalizedIdentifier(object $model): ?string diff --git a/tests/Model/ModelManagerTest.php b/tests/Model/ModelManagerTest.php index 2350fd3a..55208338 100644 --- a/tests/Model/ModelManagerTest.php +++ b/tests/Model/ModelManagerTest.php @@ -327,8 +327,10 @@ public function testFailingBatchDelete(string $expectedExceptionMessage, array $ Configuration::AUTOGENERATE_FILE_NOT_EXISTS ); $uow = new UnitOfWork($dm, $eventManager, $hydratorFactory); - /** @psalm-suppress InternalMethod */ - $hydratorFactory->setUnitOfWork($uow); + // @phpstan-ignore-next-line + if (method_exists($hydratorFactory, 'setUnitOfWork')) { + $hydratorFactory->setUnitOfWork($uow); + } $dm ->expects(static::atLeastOnce())