private function repairComments(Node $node)
{
$comment = $node->getDocComment();
if ($comment && !empty($this->classStack)) {
$regex = "(@(param|return|var|type)\\s+(\\S+))i";
$comment->setText(preg_replace_callback($regex, function ($match) {
$type = $match[2];
$type = preg_replace('((?<=^|\\|)((?i:self)|\\$this)(?=\\[|$|\\|))', end($this->classStack), $type);
return '@' . $match[1] . ' ' . $type;
}, $comment->getText()));
}
}