Skip to content

Commit 60c69b4

Browse files
authored
Fix AddGenericReturnTypeToRelationsRector on Rector 0.15.2 (#74)
Fix AddGenericReturnTypeToRelationsRector on Rector 0.15.2 On Rector 0.15.2 the test failed to run for no-phpdoc.php.inc. This fix supports both 0.14.x and 0.15.x It failed because of this change: rectorphp/rector-src@96c457b#diff-d12d9867614cdc1cab5c7942a80cafabd78d8e027d227f9ba1bc8ffeb6643f61L70
1 parent 7aae907 commit 60c69b4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use PHPStan\Type\Constant\ConstantStringType;
1717
use PHPStan\Type\Generic\GenericClassStringType;
1818
use PHPStan\Type\ObjectType;
19-
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
2019
use Rector\BetterPhpDocParser\ValueObject\Type\FullyQualifiedIdentifierTypeNode;
2120
use Rector\Core\Rector\AbstractRector;
2221
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -101,10 +100,7 @@ public function refactor(Node $node): ?Node
101100
return null;
102101
}
103102

104-
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
105-
if (! $phpDocInfo instanceof PhpDocInfo) {
106-
return null;
107-
}
103+
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
108104

109105
// Return, if already has return type
110106
if ($node->getDocComment() !== null && $phpDocInfo->hasByName('return')) {

0 commit comments

Comments
 (0)