Skip to content

Commit cf3a185

Browse files
authored
Document return type of getEntityState() (#9328)
1 parent 1599975 commit cf3a185

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

lib/Doctrine/ORM/UnitOfWork.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,6 @@ private function computeAssociationChanges(array $assoc, $value): void
951951
// so the exception will be raised from the DBAL layer (constraint violation).
952952
throw ORMInvalidArgumentException::detachedEntityFoundThroughRelationship($assoc, $entry);
953953

954-
break;
955-
956954
default:
957955
// MANAGED associated entities are already taken into account
958956
// during changeset calculation anyway, since they are in the identity map.
@@ -1568,8 +1566,10 @@ public function addToIdentityMap($entity)
15681566
* This parameter can be set to improve performance of entity state detection
15691567
* by potentially avoiding a database lookup if the distinction between NEW and DETACHED
15701568
* is either known or does not matter for the caller of the method.
1569+
* @psalm-param self::STATE_*|null $assume
15711570
*
15721571
* @return int The entity state.
1572+
* @psalm-return self::STATE_*
15731573
*/
15741574
public function getEntityState($entity, $assume = null)
15751575
{

phpstan-baseline.neon

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,11 +1890,6 @@ parameters:
18901890
count: 1
18911891
path: lib/Doctrine/ORM/UnitOfWork.php
18921892

1893-
-
1894-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
1895-
count: 1
1896-
path: lib/Doctrine/ORM/UnitOfWork.php
1897-
18981893
-
18991894
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$name\\.$#"
19001895
count: 1
@@ -1904,3 +1899,4 @@ parameters:
19041899
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$subClasses\\.$#"
19051900
count: 1
19061901
path: lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php
1902+

psalm-baseline.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,6 +3218,9 @@
32183218
<code>$entity</code>
32193219
<code>$entity</code>
32203220
</PossiblyNullArgument>
3221+
<RedundantConditionGivenDocblockType occurrences="1">
3222+
<code>$state === UnitOfWork::STATE_DETACHED</code>
3223+
</RedundantConditionGivenDocblockType>
32213224
</file>
32223225
<file src="lib/Doctrine/ORM/Tools/EntityGenerator.php">
32233226
<ArgumentTypeCoercion occurrences="4">

0 commit comments

Comments
 (0)