Skip to content

Commit fefed02

Browse files
committed
Fix NeverRuleHelper
1 parent cc62cf4 commit fefed02

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Rules/Playground/NeverRuleHelper.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ public function shouldReturnNever(ReturnStatementsNode $node, Type $returnType):
2626
$other = [];
2727
foreach ($node->getExecutionEnds() as $executionEnd) {
2828
if ($executionEnd->getStatementResult()->isAlwaysTerminating()) {
29-
if (!$executionEnd->getNode() instanceof Node\Stmt\Throw_) {
29+
$executionEndNode = $executionEnd->getNode();
30+
if (!$executionEndNode instanceof Node\Stmt\Expression) {
3031
$other[] = $executionEnd->getNode();
32+
continue;
3133
}
3234

35+
if ($executionEndNode->expr instanceof Node\Expr\Throw_) {
36+
continue;
37+
}
38+
39+
$other[] = $executionEnd->getNode();
3340
continue;
3441
}
3542

0 commit comments

Comments
 (0)