1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

fix return type never for static function calls

This commit is contained in:
kkmuffme 2022-12-16 11:52:41 +01:00
parent 5132de22e0
commit eeb0c06173
2 changed files with 3 additions and 2 deletions

View File

@ -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]
);

View File

@ -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();