Skip to content

Commit

Permalink
Turns out static method can be called on a trait
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 20, 2020
1 parent f000222 commit 86c11d3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
9 changes: 0 additions & 9 deletions src/Rules/Methods/CallStaticMethodsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@ public function processNode(Node $node, Scope $scope): array
}

$classReflection = $this->reflectionProvider->getClass($className);
if ($classReflection->isTrait()) {
return [
RuleErrorBuilder::message(sprintf(
'Call to static method %s() on trait %s.',
$methodName,
$className
))->build(),
];
}
}

$className = $classReflection->getName();
Expand Down
4 changes: 0 additions & 4 deletions tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ public function testCallStaticMethods(): void
'Call to an undefined static method CallStaticMethods\Foo::nonexistentMethod().',
303,
],
[
'Call to static method doFoo() on trait CallStaticMethods\TraitWithStaticMethod.',
323,
],
[
'Call to static method doFoo() on an unknown class CallStaticMethods\TraitWithStaticMethod.',
328,
Expand Down

0 comments on commit 86c11d3

Please sign in to comment.