Skip to content

Commit 6d5d557

Browse files
committed
Revert "Remove more specific PHPDoc @return from PHP 8.1 stubs"
This reverts commit d9dd6bf.
1 parent dafdf04 commit 6d5d557

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

extractor/extract.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use PhpParser\Comment;
55
use PhpParser\Node;
66
use PhpParser\ParserFactory;
7-
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
87
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
98
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
109
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
@@ -594,30 +593,6 @@ private function compareFunctions(Node\FunctionLike $old, Node\FunctionLike $new
594593
}
595594
}
596595

597-
if (
598-
$old->getReturnType() !== null
599-
&& $new->getReturnType() !== null
600-
&& $new->getDocComment() !== null
601-
) {
602-
if ($old->getDocComment() === null || $this->findPhpDocReturn($this->parseDocComment($old->getDocComment()->getText())) === null) {
603-
$newPhpDocNode = $this->parseDocComment($new->getDocComment()->getText());
604-
if ($this->findPhpDocReturn($newPhpDocNode) !== null) {
605-
$newPhpDocNodeWithoutReturn = new PhpDocNode(array_values(array_filter($newPhpDocNode->children, function (PhpDocChildNode $child): bool {
606-
if (!$child instanceof PhpDocTagNode) {
607-
return true;
608-
}
609-
610-
return !$child->value instanceof ReturnTagValueNode;
611-
})));
612-
if (count($newPhpDocNodeWithoutReturn->children) === 0) {
613-
$old->setAttribute('comments', []);
614-
} else {
615-
$old->setDocComment(new Comment\Doc((string) $newPhpDocNodeWithoutReturn));
616-
}
617-
}
618-
}
619-
}
620-
621596
$oldPhpDocParameters = [];
622597
$newPhpDocParameters = [];
623598
if ($old->getDocComment() !== null) {

0 commit comments

Comments
 (0)