mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Merge pull request #8902 from kkmuffme/fix-never-static-calls
fix return type never for static function calls
This commit is contained in:
commit
5afc3282d4
@ -181,7 +181,7 @@ class ReturnTypeAnalyzer
|
||||
|
||||
$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]
|
||||
);
|
||||
|
@ -89,7 +89,8 @@ class ReturnTypeCollector
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user