Skip to content

Commit c10daa4

Browse files
committed
Allow null as return type of findOneBy method
The repository function findOneBy can be null. The return type has been adjusted to allow that.
1 parent 7055460 commit c10daa4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Reflection/RepositoryFindOneByMethodReflection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\Reflection\MethodReflection;
99
use PHPStan\Type\ObjectType;
1010
use PHPStan\Type\Type;
11+
use PHPStan\Type\TypeCombinator;
1112
use TYPO3\CMS\Core\Utility\ClassNamingUtility;
1213

1314
class RepositoryFindOneByMethodReflection implements MethodReflection
@@ -94,7 +95,6 @@ public function isVariadic(): bool
9495

9596
public function getReturnType(): Type
9697
{
97-
return new ObjectType($this->getModelName());
98+
return TypeCombinator::addNull(new ObjectType($this->getModelName()));
9899
}
99-
100100
}

0 commit comments

Comments
 (0)