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