Skip to content

Commit eb59a10

Browse files
authored
Leverage node mutability in getCleanCommentsNode (#280)
1 parent 31f32a2 commit eb59a10

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Visitor.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function enterNode(Node $node)
7777
return null;
7878
}
7979

80-
$node = $this->getCleanCommentsNode($node);
80+
$this->cleanComments($node);
8181

8282
$docComment = $node->getDocComment();
8383

@@ -879,10 +879,10 @@ static function (Node $node): bool {
879879
return null;
880880
}
881881

882-
private function getCleanCommentsNode(Node $node): Node
882+
private function cleanComments(Node $node): void
883883
{
884884
if (count($node->getComments()) === 0) {
885-
return $node;
885+
return;
886886
}
887887

888888
$comments = [];
@@ -908,7 +908,5 @@ private function getCleanCommentsNode(Node $node): Node
908908
}
909909

910910
$node->setAttribute('comments', $comments);
911-
912-
return $node;
913911
}
914912
}

0 commit comments

Comments
 (0)