Skip to content

Commit

Permalink
TooWideMethodReturnTypehintRule - never report in a trait
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 7, 2023
1 parent c30e9a4 commit e0eb850
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function getNodeType(): string

public function processNode(Node $node, Scope $scope): array
{
if ($scope->isInTrait()) {
return [];
}
$method = $node->getMethodReflection();
$isFirstDeclaration = $method->getPrototype()->getDeclaringClass() === $method->getDeclaringClass();
if (!$method->isPrivate()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,20 @@ private function dolor6() {
}

}

trait FooTrait
{

private function doFoo(): ?int
{
return 1;
}

}

class UsesFooTrait
{

use FooTrait;

}

0 comments on commit e0eb850

Please sign in to comment.