mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-06 11:20:50 +00:00
Updated Rector to commit f5a45a5aeb6e5e1264d546e55dbd8880046b36ce
f5a45a5aeb
[BetterPhpDocParser] Clean up unnecessary create new ConstFetchNode() on ArrayItemClassNameDecorator (#5658)
This commit is contained in:
parent
c0bc2824b0
commit
5f3655eae9
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user