From 8709fb38b0b0c650b5e8113c56537c87e482ef81 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Mon, 1 Apr 2024 12:44:58 +0200 Subject: [PATCH] Fix templated phpdoc return type (#11407) * Improve getClassMetadata phpdoc * Update baseline --- phpstan-baseline.neon | 5 ----- psalm-baseline.xml | 8 -------- src/EntityManagerInterface.php | 2 +- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c33099dee7a..6f0a73dd5a3 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -135,11 +135,6 @@ parameters: count: 2 path: src/EntityManager.php - - - message: "#^Template type T of method Doctrine\\\\ORM\\\\EntityManagerInterface\\:\\:getClassMetadata\\(\\) is not referenced in a parameter\\.$#" - count: 1 - path: src/EntityManagerInterface.php - - message: "#^Method Doctrine\\\\ORM\\\\EntityRepository\\:\\:matching\\(\\) should return Doctrine\\\\Common\\\\Collections\\\\AbstractLazyCollection\\&Doctrine\\\\Common\\\\Collections\\\\Selectable\\ but returns Doctrine\\\\ORM\\\\LazyCriteriaCollection\\<\\(int\\|string\\), object\\>\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d04835c1e85..6c70101de13 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -257,12 +257,6 @@ - - wrapped->getClassMetadata($className)]]> - - - - @@ -309,11 +303,9 @@ name ? $entity : null]]> load($sortedId, null, null, [], $lockMode)]]> loadById($sortedId)]]> - metadataFactory->getMetadataFor($className)]]> - diff --git a/src/EntityManagerInterface.php b/src/EntityManagerInterface.php index 326cb933a59..b3b5ddf9e13 100644 --- a/src/EntityManagerInterface.php +++ b/src/EntityManagerInterface.php @@ -340,7 +340,7 @@ public function hasFilters(); * @psalm-param string|class-string $className * * @return Mapping\ClassMetadata - * @psalm-return Mapping\ClassMetadata + * @psalm-return ($className is class-string ? Mapping\ClassMetadata : Mapping\ClassMetadata) * * @psalm-template T of object */