diff --git a/composer.json b/composer.json index 6e5b15b143..b86a5aa795 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "doctrine/dbal": "^3.7.0", "doctrine/doctrine-bundle": "^2.11.0", "doctrine/orm": "^2.7", + "doctrine/persistence": "^3.0", "friendsofphp/proxy-manager-lts": "^1.0", "friendsofsymfony/http-cache-bundle": "^3.0", "friendsofsymfony/jsrouting-bundle": "^3.5", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 31292e3c16..dde7b8a6d0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -10554,12 +10554,6 @@ parameters: count: 1 path: src/lib/Persistence/Cache/UserPreferenceHandler.php - - - message: '#^Return type \(Doctrine\\ORM\\Mapping\\ClassMetadataFactory\) of method Ibexa\\Core\\Persistence\\Doctrine\\SiteAccessAwareEntityManager\:\:getMetadataFactory\(\) should be compatible with return type \(Doctrine\\Persistence\\Mapping\\ClassMetadataFactory\\>\) of method Doctrine\\Persistence\\ObjectManager\:\:getMetadataFactory\(\)$#' - identifier: method.childReturnType - count: 2 - path: src/lib/Persistence/Doctrine/SiteAccessAwareEntityManager.php - - message: '#^Property Ibexa\\Core\\Persistence\\FieldTypeRegistry\:\:\$coreFieldTypes \(array\\) does not accept array\\.$#' identifier: assign.propertyType diff --git a/src/lib/Persistence/Doctrine/SiteAccessAwareEntityManager.php b/src/lib/Persistence/Doctrine/SiteAccessAwareEntityManager.php index 88a2d51a8c..1cc0951fb2 100644 --- a/src/lib/Persistence/Doctrine/SiteAccessAwareEntityManager.php +++ b/src/lib/Persistence/Doctrine/SiteAccessAwareEntityManager.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Persistence\Doctrine; +use Doctrine\Common\EventManager; use Doctrine\DBAL\Connection; use Doctrine\ORM\Cache; use Doctrine\ORM\Configuration; @@ -15,7 +16,6 @@ use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Internal\Hydration\AbstractHydrator; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\NativeQuery; use Doctrine\ORM\Proxy\ProxyFactory; use Doctrine\ORM\Query; @@ -24,6 +24,7 @@ use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\UnitOfWork; +use Doctrine\Persistence\Mapping\ClassMetadataFactory; use Ibexa\Bundle\Core\Entity\EntityManagerFactory; use Ibexa\Contracts\Core\MVC\EventSubscriber\ConfigScopeChangeSubscriber; use Ibexa\Core\MVC\Symfony\Event\ScopeChangeEvent; @@ -78,10 +79,7 @@ public function transactional($func) return $this->getWrapped()->transactional($func); } - /** - * @return mixed - */ - public function wrapInTransaction(callable $func) + public function wrapInTransaction(callable $func): mixed { return $this->getWrapped()->wrapInTransaction($func); } @@ -127,6 +125,8 @@ public function createQueryBuilder(): QueryBuilder * @param class-string $entityName * * @return T|null + * + * @throws \Doctrine\ORM\Exception\ORMException */ public function getReference($entityName, $id): ?object { @@ -169,7 +169,7 @@ public function lock($entity, $lockMode, $lockVersion = null): void $this->getWrapped()->lock($entity, $lockMode, $lockVersion); } - public function getEventManager(): \Doctrine\Common\EventManager + public function getEventManager(): EventManager { return $this->getWrapped()->getEventManager(); } @@ -285,6 +285,7 @@ public function getClassMetadata($className): ClassMetadata public function getMetadataFactory(): ClassMetadataFactory { + /** @phpstan-var ClassMetadataFactory<\Doctrine\Persistence\Mapping\ClassMetadata> */ return $this->getWrapped()->getMetadataFactory(); } @@ -293,10 +294,7 @@ public function initializeObject(object $obj): void $this->getWrapped()->initializeObject($obj); } - /** - * @param mixed $value - */ - public function isUninitializedObject($value): bool + public function isUninitializedObject(mixed $value): bool { return $this->getWrapped()->isUninitializedObject($value); }