diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 822171ae820..459db1133bd 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -464,7 +464,7 @@ public function analyze( $this->track_mutations = true; } - if ($this->function instanceof ArrowFunction && $storage->return_type && $storage->return_type->isNever()) { + if ($this->function instanceof ArrowFunction && (!$storage->return_type || $storage->return_type->isNever())) { // ArrowFunction perform a return implicitly so if the return type is never, we have to suppress the error // note: the never can only come from phpdoc. PHP will refuse short closures with never in signature $statements_analyzer->addSuppressedIssues(['NoValue']);