Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 13, 2024
1 parent 297d217 commit 73f577f
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ private function hasThrowInAssignExpr(Assign $assign): bool
}

/**
* @return Node[]|null|If_
* @return Node[]|null
*/
private function refactorReturn(Return_ $return): array|null|If_
private function refactorReturn(Return_ $return): array|null
{
$throw = $this->betterNodeFinder->findFirstInstanceOf($return, Throw_::class);
if (! $throw instanceof Throw_) {
Expand All @@ -212,7 +212,12 @@ private function refactorReturn(Return_ $return): array|null|If_
}

if ($return->expr instanceof Ternary) {
return [$this->refactorTernary($return->expr, null), new Return_($return->expr->cond)];
$ternary = $this->refactorTernary($return->expr, null);
if (! $ternary instanceof If_) {
return null;
}

return [$ternary, new Return_($return->expr->cond)];
}

return null;
Expand Down

0 comments on commit 73f577f

Please sign in to comment.