Skip to content

Commit

Permalink
#2374 - Extract common parts from condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Aug 22, 2022
1 parent 27b663c commit e57e2f2
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions Library/ClassMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -2229,24 +2229,17 @@ public function hasChildReturnStatementType(array $statement): bool
}

$statements = $statement['else_statements'];
foreach ($statements as $item) {
$type = $item['type'] ?? null;
if ('return' === $type || 'throw' === $type) {
return true;
}

return $this->hasChildReturnStatementType($item);
}
} else {
$statements = $statement['statements'];
foreach ($statements as $item) {
$type = $item['type'] ?? null;
if ('return' === $type || 'throw' === $type) {
return true;
}
}

return $this->hasChildReturnStatementType($item);
foreach ($statements as $item) {
$type = $item['type'] ?? null;
if ('return' === $type || 'throw' === $type) {
return true;
}

return $this->hasChildReturnStatementType($item);
}

return false;
Expand Down

0 comments on commit e57e2f2

Please sign in to comment.