Skip to content

Commit

Permalink
fix StaticMethodCallCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Nov 5, 2022
1 parent 2302a61 commit f2ba789
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Rules/Methods/StaticMethodCallCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public function check(

$classType = $scope->resolveTypeByName($class);
} else {
$classStringType = $scope->getType(new Expr\ClassConstFetch($class, 'class'));
if ($classStringType->hasMethod($methodName)->yes()) {
return [[], null];
}

if (!$this->reflectionProvider->hasClass($className)) {
if ($scope->isInClassExists($className)) {
return [[], null];
Expand Down
1 change: 1 addition & 0 deletions tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,4 +537,5 @@ public function testHasMethodStaticCall(): void
$this->checkExplicitMixed = false;
$this->analyse([__DIR__ . '/data/static-has-method.php'], []);
}

}

0 comments on commit f2ba789

Please sign in to comment.