diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index c1b0af26bfa..75e8f8aae5a 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -125,11 +125,6 @@ parameters:
count: 1
path: src/EntityRepository.php
- -
- message: "#^Method Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata\\:\\:fullyQualifiedClassName\\(\\) should return class\\-string\\|null but returns string\\|null\\.$#"
- count: 1
- path: src/Mapping/ClassMetadata.php
-
-
message: "#^If condition is always true\\.$#"
count: 1
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 688463b1bb2..bf54038d816 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -290,11 +290,6 @@
$repositoryClassName
-
-
- $class
-
-
columnNames]]>
@@ -314,16 +309,7 @@
$definition
- subClasses]]>
-
- $className
- $className
- namespace . '\\' . $className]]>
-
-
- class-string|null
-
reflClass]]>
@@ -331,8 +317,6 @@
$entity
- $class
- $className
declaredField]]]>
diff --git a/src/Mapping/ClassMetadata.php b/src/Mapping/ClassMetadata.php
index 3f5b1c77732..b86ab53ee54 100644
--- a/src/Mapping/ClassMetadata.php
+++ b/src/Mapping/ClassMetadata.php
@@ -2465,12 +2465,16 @@ public function getAssociationMappedByTargetField(string $assocName): string
}
/**
- * @return string|null null if the input value is null
- * @psalm-return class-string|null
+ * @param C $className
+ *
+ * @return string|null null if and only if the input value is null
+ * @psalm-return (C is string ? string : null)
+ *
+ * @template C of string|null
*/
public function fullyQualifiedClassName(string|null $className): string|null
{
- if (empty($className)) {
+ if ($className === null) {
return $className;
}
@@ -2514,12 +2518,8 @@ public function mapEmbedded(array $mapping): void
throw MappingException::missingEmbeddedClass($mapping['fieldName']);
}
- $fqcn = $this->fullyQualifiedClassName($mapping['class']);
-
- assert($fqcn !== null);
-
$this->embeddedClasses[$mapping['fieldName']] = EmbeddedClassMapping::fromMappingArray([
- 'class' => $fqcn,
+ 'class' => $this->fullyQualifiedClassName($mapping['class']),
'columnPrefix' => $mapping['columnPrefix'] ?? null,
'declaredField' => $mapping['declaredField'] ?? null,
'originalField' => $mapping['originalField'] ?? null,