Updated Rector to commit f5a45a5aeb6e5e1264d546e55dbd8880046b36ce

f5a45a5aeb [BetterPhpDocParser] Clean up unnecessary create new ConstFetchNode() on ArrayItemClassNameDecorator (#5658)
This commit is contained in:
Tomas Votruba 2024-02-22 14:12:04 +00:00
parent c0bc2824b0
commit 5f3655eae9
2 changed files with 5 additions and 8 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'b9ea5fd9961997cecbd872cb345e88de582d6aca'; public const PACKAGE_VERSION = 'f5a45a5aeb6e5e1264d546e55dbd8880046b36ce';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-02-22 19:48:37'; public const RELEASE_DATE = '2024-02-22 14:09:52';
/** /**
* @var int * @var int
*/ */

View File

@ -5,7 +5,6 @@ namespace Rector\BetterPhpDocParser\PhpDocParser;
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode; use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use PhpParser\Node as PhpNode; use PhpParser\Node as PhpNode;
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode;
use PHPStan\PhpDocParser\Ast\Node; use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface; use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
@ -50,16 +49,14 @@ final class ArrayItemClassNameDecorator implements PhpDocNodeDecoratorInterface
if (\count($splitScopeResolution) !== 2) { if (\count($splitScopeResolution) !== 2) {
return null; return null;
} }
$firstName = $splitScopeResolution[0]; $className = $this->resolveFullyQualifiedClass($splitScopeResolution[0], $phpNode);
$constFetchNode = new ConstFetchNode($firstName, $firstName);
$className = $this->resolveFullyQualifiedClass($constFetchNode, $phpNode);
$node->setAttribute(PhpDocAttributeKey::RESOLVED_CLASS, $className); $node->setAttribute(PhpDocAttributeKey::RESOLVED_CLASS, $className);
return $node; return $node;
}); });
} }
private function resolveFullyQualifiedClass(ConstFetchNode $constFetchNode, PhpNode $phpNode) : string private function resolveFullyQualifiedClass(string $className, PhpNode $phpNode) : string
{ {
$nameScope = $this->nameScopeFactory->createNameScopeFromNodeWithoutTemplateTypes($phpNode); $nameScope = $this->nameScopeFactory->createNameScopeFromNodeWithoutTemplateTypes($phpNode);
return $nameScope->resolveStringName($constFetchNode->className); return $nameScope->resolveStringName($className);
} }
} }