private function getDocCommentForNode(Node $node)
{
// check if there is a doc comment for the ID argument
// ->trans(/** @Desc("FOO") */ 'my.id')
if (null !== ($comment = $node->args[0]->getDocComment())) {
return $comment->getText();
}
// this may be placed somewhere up in the hierarchy,
// -> /** @Desc("FOO") */ trans('my.id')
// /** @Desc("FOO") */ ->trans('my.id')
// /** @Desc("FOO") */ $translator->trans('my.id')
if (null !== ($comment = $node->getDocComment())) {
return $comment->getText();
} elseif (null !== $this->previousNode && $this->previousNode->getDocComment() !== null) {
$comment = $this->previousNode->getDocComment();
return is_object($comment) ? $comment->getText() : $comment;
}
return null;
}