Skip to content

Commit

Permalink
[Renaming] Improve performance of RenameFunctionRector (#3699)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 8, 2023
1 parent 3d7e89f commit 14a112e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rules/Renaming/Rector/FuncCall/RenameFunctionRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
// not to refactor here
$isVirtual = (bool) $node->name->getAttribute(AttributeKey::VIRTUAL_NODE);
if ($isVirtual) {
return null;
}

foreach ($this->oldFunctionToNewFunction as $oldFunction => $newFunction) {
if (! $this->isName($node, $oldFunction)) {
continue;
}

// not to refactor here
$isVirtual = (bool) $node->name->getAttribute(AttributeKey::VIRTUAL_NODE);
if ($isVirtual) {
continue;
}

$node->name = $this->createName($newFunction);
return $node;
}
Expand Down

0 comments on commit 14a112e

Please sign in to comment.