Skip to content

Commit

Permalink
Merge pull request #7399 from orklah/testnever2
Browse files Browse the repository at this point in the history
Prevent NoValue when there is no phpdoc
  • Loading branch information
orklah committed Jan 14, 2022
2 parents d2faa5b + b3e7f12 commit 1f0d3de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Expand Up @@ -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']);
Expand Down

0 comments on commit 1f0d3de

Please sign in to comment.