Skip to content

Commit a7e8881

Browse files
committed
Static analysis
1 parent 602c0ee commit a7e8881

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Exercise/TheReturnOfStatic.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ public function check(Input $input): ResultInterface
6969

7070
$finder = new NodeFinder();
7171

72-
/** @var Function_|null $adder */
72+
/** @var Stmt\Class_|null $class */
7373
$class = $finder->findFirst($statements, function (Node $node) {
74-
return $node instanceof Stmt\Class_ && $node->name->toString() === 'File';
74+
return $node instanceof Stmt\Class_ && $node->name && $node->name->toString() === 'File';
7575
});
7676

77-
/** @var ClassMethod $method */
78-
$method = $finder->findFirst([$class], function (Node $node) {
77+
/** @var ClassMethod|null $method */
78+
$method = $finder->findFirst($class ? [$class] : [], function (Node $node) {
7979
return $node instanceof ClassMethod && $node->name->toString() === 'withPermissions';
8080
});
8181

@@ -124,4 +124,4 @@ private function isCloneOfThis(Assign $assign): bool
124124

125125
return $assign->expr->expr->name === 'this';
126126
}
127-
}
127+
}

0 commit comments

Comments
 (0)