private function parse(int $type, string $value): void
    {
        switch ($type) {
            case AnnotationLexer::T_ANNOTATION:
                $this->tokenConsumer->consumeAnnotationToken($value);
                break;
            case AnnotationLexer::T_O_PARENTHESIS:
                $this->tokenConsumer->consumeOpeningParenthesisToken();
                $this->tokenConsumer->addTokenToContent($value);
                break;
            case AnnotationLexer::T_C_PARENTHESIS:
                $this->tokenConsumer->addTokenToContent($value);
                $this->tokenConsumer->consumeClosingParenthesisToken();
                break;
            case AnnotationLexer::T_SINGLE_QUOTE:
            case AnnotationLexer::T_DOUBLE_QUOTE:
                $this->tokenConsumer->addTokenToContent($value);
                $this->tokenConsumer->consumeQuoteToken($type);
                break;
            case AnnotationLexer::T_ASTERISK:
                if ($this->tokenConsumer->hasOpenedString()) {
                    // We are in a string, save this token value.
                    $this->tokenConsumer->addTokenToContent($value);
                }
                break;
            case AnnotationLexer::T_LINE_BREAK:
                $this->tokenConsumer->addTokenToContent($value);
                $this->tokenConsumer->increaseLine();
                break;
            case AnnotationLexer::T_BACKSLASH:
            case AnnotationLexer::T_WHITESPACE:
            case AnnotationLexer::T_OTHER:
                $this->tokenConsumer->addTokenToContent($value);
                break;
            default:
                throw new AnnotationParseException(sprintf('A token of value "%s" has an invalid type', $value));
        }
        $this->tokenConsumer->afterConsume($type);
    }
private function parse(int $type, string $value): void
    {
        switch ($type) {
            case AnnotationLexer::T_ANNOTATION:
                $this->tokenConsumer->consumeAnnotationToken($value);
                break;
            case AnnotationLexer::T_O_PARENTHESIS:
                $this->tokenConsumer->consumeOpeningParenthesisToken();
                $this->tokenConsumer->addTokenToContent($value);
                break;
            case AnnotationLexer::T_C_PARENTHESIS:
                $this->tokenConsumer->addTokenToContent($value);
                $this->tokenConsumer->consumeClosingParenthesisToken();
                break;
            case AnnotationLexer::T_SINGLE_QUOTE:
            case AnnotationLexer::T_DOUBLE_QUOTE:
                $this->tokenConsumer->addTokenToContent($value);
                $this->tokenConsumer->consumeQuoteToken($type);
                break;
            case AnnotationLexer::T_ASTERISK:
                if ($this->tokenConsumer->hasOpenedString()) {
                    // We are in a string, save this token value.
                    $this->tokenConsumer->addTokenToContent($value);
                }
                break;
            case AnnotationLexer::T_LINE_BREAK:
                $this->tokenConsumer->addTokenToContent($value);
                $this->tokenConsumer->increaseLine();
                break;
            case AnnotationLexer::T_BACKSLASH:
            case AnnotationLexer::T_WHITESPACE:
            case AnnotationLexer::T_OTHER:
                $this->tokenConsumer->addTokenToContent($value);
                break;
            default:
                throw new AnnotationParseException(sprintf('A token of value "%s" has an invalid type', $value));
        }
        $this->tokenConsumer->afterConsume($type);
    }
private function parse ( int $ type , string $ value ) : void { switch ( $ type ) { case AnnotationLexer :: T_ANNOTATION : $ this -> tokenConsumer -> consumeAnnotationToken ( $ value ) ; break ; case AnnotationLexer :: T_O_PARENTHESIS : $ this -> tokenConsumer -> consumeOpeningParenthesisToken ( ) ; $ this -> tokenConsumer -> addTokenToContent ( $ value ) ; break ; case AnnotationLexer :: T_C_PARENTHESIS : $ this -> tokenConsumer -> addTokenToContent ( $ value ) ; $ this -> tokenConsumer -> consumeClosingParenthesisToken ( ) ; break ; case AnnotationLexer :: T_SINGLE_QUOTE : case AnnotationLexer :: T_DOUBLE_QUOTE : $ this -> tokenConsumer -> addTokenToContent ( $ value ) ; $ this -> tokenConsumer -> consumeQuoteToken ( $ type ) ; break ; case AnnotationLexer :: T_ASTERISK : if ( $ this -> tokenConsumer -> hasOpenedString ( ) ) { // We are in a string, save this token value. $ this -> tokenConsumer -> addTokenToContent ( $ value ) ; } break ; case AnnotationLexer :: T_LINE_BREAK : $ this -> tokenConsumer -> addTokenToContent ( $ value ) ; $ this -> tokenConsumer -> increaseLine ( ) ; break ; case AnnotationLexer :: T_BACKSLASH : case AnnotationLexer :: T_WHITESPACE : case AnnotationLexer :: T_OTHER : $ this -> tokenConsumer -> addTokenToContent ( $ value ) ; break ; default : throw new AnnotationParseException ( sprintf ( 'A token of value "%s" has an invalid type' , $ value ) ) ; } $ this -> tokenConsumer -> afterConsume ( $ type ) ; }
Parse a token with a value and type, and consume it depending on type.

@param int    $type  The token type (an integer from the Lexer class constant).
@param string $value The token value.

@throws AnnotationParseException If the token type is invalid.
Parse a token with a value and type and consume it depending on type .