Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DocParser.php

function DocParser::syntaxError

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::syntaxError()

Generates a new syntax error.

Parameters

string $expected Expected string.:

mixed[]|null $token Optional token.:

5 calls to DocParser::syntaxError()
DocParser::Identifier in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Identifier ::= string
DocParser::match in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Attempts to match the given token with the current lookahead token. If they match, updates the lookahead token; otherwise raises a syntax error.
DocParser::matchAny in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Attempts to match the current lookahead token with any of the given tokens.
DocParser::PlainValue in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
PlainValue ::= integer | string | float | boolean | Array | Annotation
DocParser::resolvePositionalValues in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Resolve positional arguments (without name) to named ones

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php, line 439

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function syntaxError(string $expected, ?array $token = null) : AnnotationException {
    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 .= '.';
    return AnnotationException::syntaxError($message);
}
RSS feed
Powered by Drupal