Skip to content

Commit

Permalink
CallStaticMethodsRule - do not report abstract method called on static::
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 26, 2020
1 parent 1f272c3 commit 2639969
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Rules/Methods/CallStaticMethodsRule.php
Expand Up @@ -143,7 +143,7 @@ public function processNode(Node $node, Scope $scope): array
$className = $classReflection->getName();
$classType = new ObjectType($className);

if ($classReflection->hasNativeMethod($methodName)) {
if ($classReflection->hasNativeMethod($methodName) && $lowercasedClassName !== 'static') {
$nativeMethodReflection = $classReflection->getNativeMethod($methodName);
if ($nativeMethodReflection instanceof PhpMethodReflection || $nativeMethodReflection instanceof NativeMethodReflection) {
$isAbstract = $nativeMethodReflection->isAbstract();
Expand Down
12 changes: 12 additions & 0 deletions tests/PHPStan/Rules/Methods/data/call-parent-abstract-method.php
Expand Up @@ -60,3 +60,15 @@ abstract static function doFoo(): void;
function (): void {
SitAmet::doFoo();
};

abstract class Consecteur
{

public function doFoo()
{
static::doBar();
}

abstract public function doBar(): void;

}

0 comments on commit 2639969

Please sign in to comment.