Skip to content

Commit d5fb89f

Browse files
authored
[Core] Remove unneeded origNode attribute get on RectorRunner (#8893)
1 parent 545452a commit d5fb89f

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

‎src/Rector/RectorRunner.php‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public function __construct(
4646
*/
4747
public function run(RectorInterface $rector, Node $node): int|Node|null|array
4848
{
49-
// ensure origNode pulled before refactor to avoid changed during refactor, ref https://3v4l.org/YMEGN
50-
$originalNode = $node->getAttribute(AttributeKey::ORIGINAL_NODE) ?? $node;
51-
5249
$refactoredNodeOrState = $rector->refactor($node);
5350

5451
// nothing to change → continue
@@ -71,13 +68,13 @@ public function run(RectorInterface $rector, Node $node): int|Node|null|array
7168
}
7269

7370
// notify this rule changed code
74-
$rectorWithLineChange = new RectorWithLineChange($rector::class, $originalNode->getStartLine());
71+
$rectorWithLineChange = new RectorWithLineChange($rector::class, $node->getStartLine());
7572
$file->addRectorClassWithLine($rectorWithLineChange);
7673

7774
return $refactoredNodeOrState;
7875
}
7976

80-
return $this->postRefactorProcess($rector, $file, $originalNode, $node, $refactoredNodeOrState, $filePath);
77+
return $this->postRefactorProcess($rector, $file, $node, $refactoredNodeOrState, $filePath);
8178
}
8279

8380
private function getFile(): File
@@ -99,13 +96,12 @@ private function getFile(): File
9996
private function postRefactorProcess(
10097
RectorInterface $rector,
10198
File $file,
102-
Node $originalNode,
10399
Node $node,
104100
Node|array $refactoredNode,
105101
string $filePath
106102
): Node|array {
107103
/** @var non-empty-array<Node>|Node $refactoredNode */
108-
$rectorWithLineChange = new RectorWithLineChange($rector::class, $originalNode->getStartLine());
104+
$rectorWithLineChange = new RectorWithLineChange($rector::class, $node->getStartLine());
109105
$file->addRectorClassWithLine($rectorWithLineChange);
110106

111107
/** @var MutatingScope|null $currentScope */

0 commit comments

Comments
 (0)