Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use PHPStan\Type\ArrayType;
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
use PHPStan\Type\IntegerType;
use PHPStan\Type\NullType;
use PHPStan\Type\TypeCombinator;
use function lcfirst;
use function str_replace;
Expand Down Expand Up @@ -88,10 +87,7 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
{
$repositoryAncesor = $classReflection->getAncestorWithClassName(ObjectRepository::class);
if ($repositoryAncesor === null) {
$repositoryAncesor = $classReflection->getAncestorWithClassName(ObjectRepository::class);
if ($repositoryAncesor === null) {
throw new ShouldNotHappenException();
}
Comment on lines -91 to -94
Copy link
Copy Markdown
Contributor Author

@staabm staabm Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the past this code was used to support ObjectRepository classes from different namespaces (across different major versions of doctrine), see a497a38#diff-3cbc418c0bd3c05155f1b1f786e9a6c12efe64d7599b402dbd19299942061b74R47-R53

the remaining code references the very same class which is a leftover of this feature which no longer exists

throw new ShouldNotHappenException();
}

$templateTypeMap = $repositoryAncesor->getActiveTemplateTypeMap();
Expand All @@ -107,7 +103,7 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
} elseif (
strpos($methodName, 'findOneBy') === 0
) {
$returnType = TypeCombinator::union($entityClassType, new NullType());
$returnType = TypeCombinator::addNull($entityClassType);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by cleanup

} elseif (
strpos($methodName, 'countBy') === 0
) {
Expand Down
Loading