Doctrine\Common\Annotations\DocParser::syntaxError PHP Method

syntaxError() private method

Generates a new syntax error.
private syntaxError ( string $expected, array | null $token = null ) : void
$expected string Expected string.
$token array | null Optional token.
return void
    private function syntaxError($expected, $token = null)
    {
        if ($token === null) {
            $token = $this->lexer->lookahead;
        }
        $message = sprintf('Expected %s, got ', $expected);
        $message .= $this->lexer->lookahead === null ? 'end of string' : sprintf("'%s' at position %s", $token['value'], $token['position']);
        if (strlen($this->context)) {
            $message .= ' in ' . $this->context;
        }
        $message .= '.';
        throw AnnotationException::syntaxError($message);
    }