1
0
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:
orklah 2022-12-16 22:06:19 +01:00 committed by GitHub
commit 5afc3282d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();