mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 04:10:51 +00:00
Updated Rector to commit e138f84792e483e8b653dc79271be376bbc1e41d
e138f84792
[AutoImport] Fixing auto import on multiple @\ usage (#5271)
This commit is contained in:
parent
7a8bc36a24
commit
b8b986a680
|
@ -143,11 +143,12 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
foreach ($phpDocNode->children as $key => $phpDocChildNode) {
|
||||
// the @\FQN use case
|
||||
if ($phpDocChildNode instanceof PhpDocTextNode) {
|
||||
$spacelessPhpDocTagNode = $this->resolveFqnAnnotationSpacelessPhpDocTagNode($phpDocChildNode, $currentPhpNode);
|
||||
if (!$spacelessPhpDocTagNode instanceof SpacelessPhpDocTagNode) {
|
||||
$spacelessPhpDocTagNodes = $this->resolveFqnAnnotationSpacelessPhpDocTagNode($phpDocChildNode, $currentPhpNode);
|
||||
if ($spacelessPhpDocTagNodes === []) {
|
||||
continue;
|
||||
}
|
||||
$phpDocNode->children[$key] = $spacelessPhpDocTagNode;
|
||||
unset($phpDocNode->children[$key]);
|
||||
\array_splice($phpDocNode->children, $key, 0, $spacelessPhpDocTagNodes);
|
||||
continue;
|
||||
}
|
||||
if (!$phpDocChildNode instanceof PhpDocTagNode) {
|
||||
|
@ -216,16 +217,23 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface
|
|||
$nextStartAndEnd = $endPhpDocChildNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
return new StartAndEnd($currentStartAndEnd->getStart(), $nextStartAndEnd->getEnd());
|
||||
}
|
||||
private function resolveFqnAnnotationSpacelessPhpDocTagNode(PhpDocTextNode $phpDocTextNode, Node $currentPhpNode) : ?SpacelessPhpDocTagNode
|
||||
/**
|
||||
* @return SpacelessPhpDocTagNode[]
|
||||
*/
|
||||
private function resolveFqnAnnotationSpacelessPhpDocTagNode(PhpDocTextNode $phpDocTextNode, Node $currentPhpNode) : array
|
||||
{
|
||||
$match = Strings::match($phpDocTextNode->text, self::LONG_ANNOTATION_REGEX);
|
||||
$fullyQualifiedAnnotationClass = $match['class_name'] ?? null;
|
||||
if ($fullyQualifiedAnnotationClass === null) {
|
||||
return null;
|
||||
$matches = Strings::matchAll($phpDocTextNode->text, self::LONG_ANNOTATION_REGEX);
|
||||
$spacelessPhpDocTagNodes = [];
|
||||
foreach ($matches as $match) {
|
||||
$fullyQualifiedAnnotationClass = $match['class_name'] ?? null;
|
||||
if ($fullyQualifiedAnnotationClass === null) {
|
||||
continue;
|
||||
}
|
||||
$annotationContent = $match['annotation_content'] ?? null;
|
||||
$tagName = '@\\' . $fullyQualifiedAnnotationClass;
|
||||
$formerStartEnd = $phpDocTextNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
$spacelessPhpDocTagNodes[] = $this->createDoctrineSpacelessPhpDocTagNode($annotationContent, $tagName, $fullyQualifiedAnnotationClass, $formerStartEnd, $currentPhpNode);
|
||||
}
|
||||
$annotationContent = $match['annotation_content'] ?? null;
|
||||
$tagName = '@\\' . $fullyQualifiedAnnotationClass;
|
||||
$formerStartEnd = $phpDocTextNode->getAttribute(PhpDocAttributeKey::START_AND_END);
|
||||
return $this->createDoctrineSpacelessPhpDocTagNode($annotationContent, $tagName, $fullyQualifiedAnnotationClass, $formerStartEnd, $currentPhpNode);
|
||||
return $spacelessPhpDocTagNodes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ final class PhpDocInfoPrinter
|
|||
$lastTokenPosition = $this->currentTokenPosition;
|
||||
}
|
||||
if ($lastTokenPosition === 0) {
|
||||
$lastTokenPosition = 1;
|
||||
return $output . "\n */";
|
||||
}
|
||||
return $this->addTokensFromTo($output, $lastTokenPosition, $this->tokenCount, \true);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '189a02635533f450aea58d8de075e494f538182b';
|
||||
public const PACKAGE_VERSION = 'e138f84792e483e8b653dc79271be376bbc1e41d';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-11-21 14:30:22';
|
||||
public const RELEASE_DATE = '2023-11-22 06:34:49';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -504,8 +504,8 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate\/container",
|
||||
"version": "v10.32.1",
|
||||
"version_normalized": "10.32.1.0",
|
||||
"version": "v10.33.0",
|
||||
"version_normalized": "10.33.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/container.git",
|
||||
|
@ -561,8 +561,8 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate\/contracts",
|
||||
"version": "v10.32.1",
|
||||
"version_normalized": "10.32.1.0",
|
||||
"version": "v10.33.0",
|
||||
"version_normalized": "10.33.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/contracts.git",
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user