| @@ 219-239 (lines=21) @@ | ||
| 216 | * @param Node $node |
|
| 217 | * @return null|string |
|
| 218 | */ |
|
| 219 | private function getDocCommentForNode(Node $node) |
|
| 220 | { |
|
| 221 | // check if there is a doc comment for the ID argument |
|
| 222 | // ->trans(/** @Desc("FOO") */ 'my.id') |
|
| 223 | if (null !== $comment = $node->args[0]->getDocComment()) { |
|
| 224 | return $comment->getText(); |
|
| 225 | } |
|
| 226 | ||
| 227 | // this may be placed somewhere up in the hierarchy, |
|
| 228 | // -> /** @Desc("FOO") */ trans('my.id') |
|
| 229 | // /** @Desc("FOO") */ ->trans('my.id') |
|
| 230 | // /** @Desc("FOO") */ $translator->trans('my.id') |
|
| 231 | if (null !== $comment = $node->getDocComment()) { |
|
| 232 | return $comment->getText(); |
|
| 233 | } elseif (null !== $this->previousNode && $this->previousNode->getDocComment() !== null) { |
|
| 234 | $comment = $this->previousNode->getDocComment(); |
|
| 235 | return is_object($comment) ? $comment->getText() : $comment; |
|
| 236 | } |
|
| 237 | ||
| 238 | return null; |
|
| 239 | } |
|
| 240 | } |
|
| 241 | ||
| @@ 220-240 (lines=21) @@ | ||
| 217 | * @param Node $node |
|
| 218 | * @return null|string |
|
| 219 | */ |
|
| 220 | private function getDocCommentForNode(Node $node) |
|
| 221 | { |
|
| 222 | // check if there is a doc comment for the ID argument |
|
| 223 | // ->trans(/** @Desc("FOO") */ 'my.id') |
|
| 224 | if (null !== $comment = $node->args[0]->getDocComment()) { |
|
| 225 | return $comment->getText(); |
|
| 226 | } |
|
| 227 | ||
| 228 | // this may be placed somewhere up in the hierarchy, |
|
| 229 | // -> /** @Desc("FOO") */ trans('my.id') |
|
| 230 | // /** @Desc("FOO") */ ->trans('my.id') |
|
| 231 | // /** @Desc("FOO") */ $translator->trans('my.id') |
|
| 232 | if (null !== $comment = $node->getDocComment()) { |
|
| 233 | return $comment->getText(); |
|
| 234 | } elseif (null !== $this->previousNode && $this->previousNode->getDocComment() !== null) { |
|
| 235 | $comment = $this->previousNode->getDocComment(); |
|
| 236 | return is_object($comment) ? $comment->getText() : $comment; |
|
| 237 | } |
|
| 238 | ||
| 239 | return null; |
|
| 240 | } |
|
| 241 | } |
|
| 242 | ||