diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php index 8444abff344..860af43801c 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php @@ -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] ); diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php index d71a547f402..07dbf8145fd 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php @@ -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();