Skip to content

Commit

Permalink
fixup! fixup! fixup! inliner var
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Dec 23, 2022
1 parent d2af4bd commit 6aa6a7a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Iterator;
use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDoc\Tag\VarTag;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher;
Expand Down Expand Up @@ -50,9 +51,11 @@ public function testResolvesClass(string $filePath): void
foreach ($properties as $property) {
/** @var Property $property */
$phpDoc = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
/** @var VarTagValueNode $varTag */
$varTag = $phpDoc->getByType(VarTagValueNode::class)[0];
$value = $varTag->type->__toString();

$varTagValueNode = $phpDoc->getVarTagValueNode();
$this->assertInstanceOf(VarTagValueNode::class, $varTagValueNode);

$value = $varTagValueNode->type->__toString();
$propertyName = strtolower($this->nodeNameResolver->getName($property));

$result = $this->classAnnotationMatcher->resolveTagToKnownFullyQualifiedName($value, $property);
Expand Down
1 change: 1 addition & 0 deletions packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ final class VarAnnotationManipulator
public function __construct(
private readonly PhpDocInfoFactory $phpDocInfoFactory,
private readonly PhpDocTypeChanger $phpDocTypeChanger,
private readonly BetterNodeFinder $betterNodeFinder
) {
}

Expand Down

0 comments on commit 6aa6a7a

Please sign in to comment.