1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Clone all comments, not just docs

This commit is contained in:
Matthew Brown 2018-10-27 21:21:57 -04:00
parent 6ba76e1589
commit 0d7661dd3f

View File

@ -15,8 +15,19 @@ class CloningVisitor extends NodeVisitorAbstract
public function enterNode(Node $origNode)
{
$node = clone $origNode;
if ($c = $node->getDocComment()) {
$node->setDocComment(clone $c);
if ($cs = $node->getComments()) {
$node->setAttribute(
'comments',
array_map(
/**
* @return \PhpParser\Comment
*/
function (\PhpParser\Comment $c) {
return clone $c;
},
$cs
)
);
}
return $node;
}