Skip to content

Commit 86c11d3

Browse files
committed
Turns out static method can be called on a trait
1 parent f000222 commit 86c11d3

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/Rules/Methods/CallStaticMethodsRule.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,6 @@ public function processNode(Node $node, Scope $scope): array
136136
}
137137

138138
$classReflection = $this->reflectionProvider->getClass($className);
139-
if ($classReflection->isTrait()) {
140-
return [
141-
RuleErrorBuilder::message(sprintf(
142-
'Call to static method %s() on trait %s.',
143-
$methodName,
144-
$className
145-
))->build(),
146-
];
147-
}
148139
}
149140

150141
$className = $classReflection->getName();

tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,6 @@ public function testCallStaticMethods(): void
219219
'Call to an undefined static method CallStaticMethods\Foo::nonexistentMethod().',
220220
303,
221221
],
222-
[
223-
'Call to static method doFoo() on trait CallStaticMethods\TraitWithStaticMethod.',
224-
323,
225-
],
226222
[
227223
'Call to static method doFoo() on an unknown class CallStaticMethods\TraitWithStaticMethod.',
228224
328,

0 commit comments

Comments
 (0)