diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php index 2ce6434c00f..f0ab1bc8447 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php +++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeCollector.php @@ -352,7 +352,12 @@ protected static function getYieldTypeFromExpression( if ($stmt instanceof PhpParser\Node\Expr\MethodCall || $stmt instanceof PhpParser\Node\Expr\FuncCall || $stmt instanceof PhpParser\Node\Expr\StaticCall - || $stmt instanceof PhpParser\Node\Expr\New_) { + || $stmt instanceof PhpParser\Node\Expr\New_ + ) { + if ($stmt->isFirstClassCallable()) { + return []; + } + $yield_types = []; foreach ($stmt->getArgs() as $arg) {