Пример #1
0
 private function findAtomDocblock(DivinerAtom $atom, XHPASTNode $node)
 {
     $token = $node->getDocblockToken();
     if ($token) {
         $atom->setDocblockRaw($token->getValue());
         return true;
     } else {
         $tokens = $node->getTokens();
         if ($tokens) {
             $prev = head($tokens);
             while ($prev = $prev->getPrevToken()) {
                 if ($prev->isAnyWhitespace()) {
                     continue;
                 }
                 break;
             }
             if ($prev && $prev->isComment()) {
                 $value = $prev->getValue();
                 $matches = null;
                 if (preg_match('/@(return|param|task|author)/', $value, $matches)) {
                     $atom->addWarning(pht('Atom "%s" is preceded by a comment containing `%s`, but ' . 'the comment is not a documentation comment. Documentation ' . 'comments must begin with `%s`, followed by a newline. Did ' . 'you mean to use a documentation comment? (As the comment is ' . 'not a documentation comment, it will be ignored.)', $atom->getName(), '@' . $matches[1], '/**'));
                 }
             }
         }
         $atom->setDocblockRaw('');
         return false;
     }
 }