Skip to content

Commit 86f3c26

Browse files
committed
MagicRepositoryMethodCallRule - check for existing method earlier
1 parent 2ce6752 commit 86f3c26

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Rules/Doctrine/ORM/MagicRepositoryMethodCallRule.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public function processNode(Node $node, Scope $scope): array
4848
}
4949

5050
$methodName = $methodNameIdentifier->toString();
51+
$repositoryReflectionClass = $this->broker->getClass($calledOnType->getClassName());
52+
if ($repositoryReflectionClass->hasNativeMethod($methodName)) {
53+
return [];
54+
}
55+
5156
if (
5257
strpos($methodName, 'findBy') === 0
5358
&& strlen($methodName) > strlen('findBy')
@@ -83,11 +88,6 @@ public function processNode(Node $node, Scope $scope): array
8388
return [];
8489
}
8590

86-
$repositoryReflectionClass = $this->broker->getClass($calledOnType->getClassName());
87-
if ($repositoryReflectionClass->hasNativeMethod($methodName)) {
88-
return [];
89-
}
90-
9191
return [sprintf(
9292
'Call to method %s::%s() - entity %s does not have a field named $%s.',
9393
$calledOnType->describe(VerbosityLevel::typeOnly()),

0 commit comments

Comments
 (0)