Skip to content

Commit 95ffd12

Browse files
committed
Fixed EntityRepositoryClassReflectionExtension
1 parent 1f2e082 commit 95ffd12

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Reflection/Doctrine/EntityRepositoryClassReflectionExtension.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ class EntityRepositoryClassReflectionExtension implements \PHPStan\Reflection\Me
99

1010
public function hasMethod(\PHPStan\Reflection\ClassReflection $classReflection, string $methodName): bool
1111
{
12-
return $classReflection->getName() === 'Doctrine\ORM\EntityRepository'
13-
&& (strpos($methodName, 'findBy') === 0 || strpos($methodName, 'findOneBy') === 0);
12+
return (
13+
$classReflection->getName() === 'Doctrine\ORM\EntityRepository'
14+
|| $classReflection->isSubclassOf('Doctrine\ORM\EntityRepository')
15+
) && (
16+
strpos($methodName, 'findBy') === 0
17+
|| strpos($methodName, 'findOneBy') === 0
18+
|| strpos($methodName, 'countBy') === 0
19+
);
1420
}
1521

1622
public function getMethod(\PHPStan\Reflection\ClassReflection $classReflection, string $methodName): \PHPStan\Reflection\MethodReflection

0 commit comments

Comments
 (0)