getDocumentation()) { $documentation[] = $comment; } } if (null !== $comment = $node->getDocumentation()) { $documentation[] = $comment; } if ($documentation) { $node->setDocumentation(implode("\n", $documentation)); } } public static function move(Node $source, Node $target): void { if (null !== $documentation = $source->getDocumentation()) { self::prepend($target, $documentation); $source->setDocumentation(null); } } private static function prepend(Node $node, string $documentation): void { if (null !== $currentDocumentation = $node->getDocumentation()) { $documentation .= "\n".$currentDocumentation; } $node->setDocumentation($documentation); } }