Skip to content

Commit

Permalink
Updated Rector to commit 3f42ee98ffefc73677b93308fe53508bd260a574
Browse files Browse the repository at this point in the history
rectorphp/rector-src@3f42ee9 [BetterPhpDocParser] Use ORIG_NODE attribute on DoctrineAnnotationDecorator on handle @\ after generic (#5285)
  • Loading branch information
TomasVotruba committed Nov 25, 2023
1 parent e9aa33c commit 2591f22
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private function transformGenericTagValueNodesToDoctrineAnnotationTagValueNodes(
$this->attributeMirrorer->mirror($phpDocNode->children[$key], $spacelessPhpDocTagNode);
$phpDocNode->children[$key] = $spacelessPhpDocTagNode;
// require to reprint the generic
$phpDocNode->children[$key]->setAttribute(PhpDocAttributeKey::IS_AFTER_GENERIC, \true);
$phpDocNode->children[$key]->value->setAttribute(PhpDocAttributeKey::ORIG_NODE, null);
\array_splice($phpDocNode->children, $key + 1, 0, $spacelessPhpDocTagNodes);
}
}
Expand Down
6 changes: 1 addition & 5 deletions packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\PhpDocParser\Lexer\Lexer;
use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor;
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
Expand Down Expand Up @@ -279,10 +278,7 @@ private function correctPreviouslyReprintedFirstNode(int $key, StartAndEnd $star
private function shouldReprint(PhpDocChildNode $phpDocChildNode) : bool
{
$this->changedPhpDocNodeTraverser->traverse($phpDocChildNode);
if ($this->changedPhpDocNodeVisitor->hasChanged()) {
return \true;
}
return $phpDocChildNode instanceof SpacelessPhpDocTagNode && $phpDocChildNode->getAttribute(PhpDocAttributeKey::IS_AFTER_GENERIC) === \true;
return $this->changedPhpDocNodeVisitor->hasChanged();
}
private function standardPrintPhpDocChildNode(PhpDocChildNode $phpDocChildNode) : string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ final class PhpDocAttributeKey
* @var string
*/
public const ORIG_NODE = NativePhpDocAttributeKey::ORIG_NODE;
/**
* @var string
*/
public const IS_AFTER_GENERIC = 'is_after_generic';
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ final class CloningPhpDocNodeVisitor extends \Rector\PhpDocParser\PhpDocParser\P
public function enterNode(Node $node) : Node
{
$clonedNode = clone $node;
$clonedNode->setAttribute(PhpDocAttributeKey::ORIG_NODE, $node);
if (!$clonedNode->hasAttribute(PhpDocAttributeKey::ORIG_NODE)) {
$clonedNode->setAttribute(PhpDocAttributeKey::ORIG_NODE, $node);
}
return $clonedNode;
}
}
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '5adf574161ebce53984822da71d711e3b2ba10e9';
public const PACKAGE_VERSION = '3f42ee98ffefc73677b93308fe53508bd260a574';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-11-25 08:45:31';
public const RELEASE_DATE = '2023-11-25 11:54:21';
/**
* @var int
*/
Expand Down

0 comments on commit 2591f22

Please sign in to comment.