From a29cb0ea395a86f67e185eca58543faa5861f321 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 11 Oct 2026 00:56:50 +0200 Subject: [PATCH] [Renaming] Speed up RenameClassRector by deferring oldToNewTypes build --- rules/Renaming/NodeManipulator/ClassRenamer.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rules/Renaming/NodeManipulator/ClassRenamer.php b/rules/Renaming/NodeManipulator/ClassRenamer.php index 90af400e6e4..1f1d2ed767f 100644 --- a/rules/Renaming/NodeManipulator/ClassRenamer.php +++ b/rules/Renaming/NodeManipulator/ClassRenamer.php @@ -50,8 +50,6 @@ public function __construct( */ public function renameNode(Node $node, array $oldToNewClasses, ?Scope $scope): ?Node { - $oldToNewTypes = $this->createOldToNewTypes($oldToNewClasses); - // execute FullyQualified before Name on purpose so next Name check is pure Name node if ($node instanceof FullyQualified) { return $this->refactorName($node, $oldToNewClasses, $scope); @@ -69,6 +67,7 @@ public function renameNode(Node $node, array $oldToNewClasses, ?Scope $scope): ? $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); if ($phpDocInfo instanceof PhpDocInfo) { + $oldToNewTypes = $this->createOldToNewTypes($oldToNewClasses); $hasPhpDocChanged = $this->refactorPhpDoc($node, $oldToNewTypes, $oldToNewClasses, $phpDocInfo); if ($hasPhpDocChanged) {