Admin
dashboard
file manager
command
php exec
/
/
opt
/
cpanel
/
ea-wappspector
/
vendor
/
rector
/
rector
/
src
/
BetterPhpDocParser
/
Comment
path:
go
upload
mkdir
name
type
size
perms
modified
actions
[parent directory]
CommentsMerger.php
file
725 B
0644
2024-11-08 13:59:10
edit
delete
rename
editing: CommentsMerger.php
<?php declare (strict_types=1); namespace Rector\BetterPhpDocParser\Comment; use PhpParser\Node; use Rector\NodeTypeResolver\Node\AttributeKey; final class CommentsMerger { /** * @param Node[] $mergedNodes */ public function keepComments(Node $newNode, array $mergedNodes) : void { $comments = $newNode->getComments(); foreach ($mergedNodes as $mergedNode) { $comments = \array_merge($comments, $mergedNode->getComments()); } if ($comments === []) { return; } $newNode->setAttribute(AttributeKey::COMMENTS, $comments); // remove so comments "win" $newNode->setAttribute(AttributeKey::PHP_DOC_INFO, null); } }
save
cancel