Skip to content

Commit

Permalink
use directly ParamTagValueNode (#2412)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jun 2, 2022
1 parent d3a9210 commit ba0869a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 69 deletions.
3 changes: 1 addition & 2 deletions packages-tests/BetterPhpDocParser/PhpDocNodeMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
use Rector\BetterPhpDocParser\PhpDocNodeMapper;
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\VariadicAwareParamTagValueNode;
use Rector\Testing\PHPUnit\AbstractTestCase;

final class PhpDocNodeMapperTest extends AbstractTestCase
Expand All @@ -36,7 +35,7 @@ public function testParamTag(): void
// test param tag
/** @var PhpDocTagNode $childNode */
$propertyTagValueNode = $childNode->value;
$this->assertInstanceOf(VariadicAwareParamTagValueNode::class, $propertyTagValueNode);
$this->assertInstanceOf(ParamTagValueNode::class, $propertyTagValueNode);
}

/**
Expand Down

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions rules/DeadCode/PhpDoc/DeadParamTagValueNodeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\VariadicAwareParamTagValueNode;
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
use Rector\DeadCode\TypeNodeAnalyzer\GenericTypeNodeAnalyzer;
Expand Down Expand Up @@ -122,7 +121,7 @@ private function isTextNextline(int $key, PhpDocChildNode $phpDocChildNode): boo

private function isUnionIdentifier(PhpDocTagNode $phpDocTagNode): bool
{
if (! $phpDocTagNode->value instanceof VariadicAwareParamTagValueNode) {
if (! $phpDocTagNode->value instanceof ParamTagValueNode) {
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Rector\TypeDeclaration\PhpDocParser;

use PhpParser\Node\Param;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\VariadicAwareParamTagValueNode;
use Rector\NodeNameResolver\NodeNameResolver;

final class ParamPhpDocNodeFactory
Expand All @@ -16,9 +16,9 @@ public function __construct(
) {
}

public function create(TypeNode $typeNode, Param $param): VariadicAwareParamTagValueNode
public function create(TypeNode $typeNode, Param $param): ParamTagValueNode
{
return new VariadicAwareParamTagValueNode(
return new ParamTagValueNode(
$typeNode,
$param->variadic,
'$' . $this->nodeNameResolver->getName($param),
Expand Down

0 comments on commit ba0869a

Please sign in to comment.