Skip to content

Commit

Permalink
Revert Performance: Early return in PhpDocNode refactoring for class …
Browse files Browse the repository at this point in the history
…renames (#3509) (#3744)

This reverts commit 48e431b.
  • Loading branch information
samsonasik committed May 6, 2023
1 parent 6a8ebb9 commit c6cb214
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions rules/Renaming/NodeManipulator/ClassRenamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ public function renameNode(Node $node, array $oldToNewClasses): ?Node
*/
private function refactorPhpDoc(Node $node, array $oldToNewTypes, array $oldToNewClasses): void
{
if (!$this->hasOriginalNodePhpDoc($node)) {
// no need to create empty PHPDoc nodes and traverse over those, if the code had no PHPDoc in the first place
return;
}

$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
if (! $phpDocInfo->hasByTypes(NodeTypes::TYPE_AWARE_NODES) && ! $phpDocInfo->hasByAnnotationClasses(
NodeTypes::TYPE_AWARE_DOCTRINE_ANNOTATION_CLASSES
Expand Down Expand Up @@ -492,17 +487,4 @@ private function resolveOldToNewClassCallbacks(Node $node, array $oldToNewClasse
{
return [...$oldToNewClasses, ...$this->renameClassCallbackHandler->getOldToNewClassesFromNode($node)];
}

/**
* Checks whether the original node has any PHPDoc comments.
*/
private function hasOriginalNodePhpDoc(Node $node): bool
{
$origNode = $node->getAttribute(AttributeKey::ORIGINAL_NODE);
if ($origNode instanceof Node && $origNode->getDocComment() === null && $origNode->getComments() === []) {
return false;
}

return true;
}
}

0 comments on commit c6cb214

Please sign in to comment.