Skip to content

Commit 0f6f1b0

Browse files
committed
Fix
1 parent 980b7bf commit 0f6f1b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/PhpDocDecorator/PhpDocFromTypeDeclarationDecorator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public function decorateReturn(ClassMethod|Function_|Closure|ArrowFunction $func
7474
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike);
7575

7676
$returnTagValueNode = $phpDocInfo->getReturnTagValue();
77-
$returnType = $returnTagValueNode instanceof ReturnTagValueNode
77+
78+
$returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($functionLike->returnType);
79+
$returnDocType = $returnTagValueNode instanceof ReturnTagValueNode
7880
? $this->staticTypeMapper->mapPHPStanPhpDocTypeToPHPStanType($returnTagValueNode, $functionLike->returnType)
7981
: $this->staticTypeMapper->mapPhpParserNodePHPStanType($functionLike->returnType);
8082

@@ -88,7 +90,7 @@ public function decorateReturn(ClassMethod|Function_|Closure|ArrowFunction $func
8890
return;
8991
}
9092

91-
$this->phpDocTypeChanger->changeReturnType($functionLike, $phpDocInfo, $returnType);
93+
$this->phpDocTypeChanger->changeReturnType($functionLike, $phpDocInfo, $returnDocType);
9294

9395
$functionLike->returnType = null;
9496
if (! $functionLike instanceof ClassMethod) {

0 commit comments

Comments
 (0)