示例#1
0
 private function parseDocComment(DocLexer $lexer, $symbol, $repeatCount)
 {
     $lexer->resetPeek();
     if (($token = $lexer->peek()) === null) {
         return false;
     }
     if ($token['type'] !== DocLexer::T_IDENTIFIER || $token['value'] !== $symbol) {
         return false;
     }
     $ids = [];
     $tk = $lexer->peek();
     while ($repeatCount-- > 0) {
         if ($tk === null || $tk['type'] !== DocLexer::T_IDENTIFIER) {
             return false;
         }
         $tks = [$tk['value']];
         while (($tk = $lexer->peek()) && $tk['type'] === DocLexer::T_NONE && in_array($tk['value'], ['[', ']'])) {
             $tks[] = $tk['value'];
         }
         $ids[] = implode('', $tks);
     }
     return $ids;
 }