diff --git a/lib/Doctrine/ODM/MongoDB/DocumentManager.php b/lib/Doctrine/ODM/MongoDB/DocumentManager.php index 6e22ea9175..428c33b22e 100644 --- a/lib/Doctrine/ODM/MongoDB/DocumentManager.php +++ b/lib/Doctrine/ODM/MongoDB/DocumentManager.php @@ -306,14 +306,12 @@ public function getClassNameResolver(): ClassNameResolver * @psalm-return ClassMetadata * * @template T of object + * + * @psalm-suppress InvalidReturnType, InvalidReturnStatement */ public function getClassMetadata($className): ClassMetadata { - /** @psalm-var ClassMetadata $metadata */ - $metadata = $this->metadataFactory->getMetadataFor($className); - assert($metadata instanceof ClassMetadata); - - return $metadata; + return $this->metadataFactory->getMetadataFor($className); } /** diff --git a/lib/Doctrine/ODM/MongoDB/UnitOfWork.php b/lib/Doctrine/ODM/MongoDB/UnitOfWork.php index a9b6a83b98..36dc773036 100644 --- a/lib/Doctrine/ODM/MongoDB/UnitOfWork.php +++ b/lib/Doctrine/ODM/MongoDB/UnitOfWork.php @@ -1626,6 +1626,8 @@ public function removeFromIdentityMap(object $document): bool * @throws InvalidArgumentException If the class does not have an identifier. * * @template T of object + * + * @psalm-suppress InvalidReturnStatement, InvalidReturnType */ public function getById($id, ClassMetadata $class): object { @@ -1653,6 +1655,8 @@ public function getById($id, ClassMetadata $class): object * @throws InvalidArgumentException If the class does not have an identifier. * * @template T of object + * + * @psalm-suppress InvalidReturnStatement, InvalidReturnType */ public function tryGetById($id, ClassMetadata $class) {