示例#1
0
 /**
  * Peeks beyond the matched closing parenthesis and returns the first token after that one.
  *
  * @param bool $resetPeek Reset peek after finding the closing parenthesis.
  *
  * @return array
  */
 protected function peekBeyondClosingParenthesis($resetPeek = true)
 {
     $token = $this->lexer->peek();
     $numUnmatched = 1;
     while ($numUnmatched > 0 && $token !== null) {
         switch ($token['type']) {
             case Lexer::T_OPEN_PARENTHESIS:
                 ++$numUnmatched;
                 break;
             case Lexer::T_CLOSE_PARENTHESIS:
                 --$numUnmatched;
                 break;
             default:
                 // Do nothing
         }
         $token = $this->lexer->peek();
     }
     if ($resetPeek) {
         $this->lexer->resetPeek();
     }
     return $token;
 }