Skip to content

Commit

Permalink
Merge pull request #8902 from kkmuffme/fix-never-static-calls
Browse files Browse the repository at this point in the history
fix return type never for static function calls
  • Loading branch information
orklah committed Dec 16, 2022
2 parents 4d0ddf6 + eeb0c06 commit 5afc328
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -181,7 +181,7 @@ public static function verifyReturnType(

$function_always_exits = $control_actions === [ScopeAnalyzer::ACTION_END];

$function_returns_implicitly = (bool)array_diff(
$function_returns_implicitly = (bool) array_diff(
$control_actions,
[ScopeAnalyzer::ACTION_END, ScopeAnalyzer::ACTION_RETURN]
);
Expand Down
Expand Up @@ -89,7 +89,8 @@ public static function getReturnTypes(
break;
}

if ($stmt->expr instanceof PhpParser\Node\Expr\FuncCall) {
if ($stmt->expr instanceof PhpParser\Node\Expr\FuncCall
|| $stmt->expr instanceof PhpParser\Node\Expr\StaticCall) {
$stmt_type = $nodes->getType($stmt->expr);
if ($stmt_type && ($stmt_type->isNever() || $stmt_type->explicit_never)) {
$return_types[] = Type::getNever();
Expand Down

0 comments on commit 5afc328

Please sign in to comment.