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

Breadcrumb

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

function ParserAbstract::getErrorMessage

Format error message including expected tokens.

Parameters

int $symbol Unexpected symbol:

int $state State at time of error:

Return value

string Formatted error message

1 call to ParserAbstract::getErrorMessage()
ParserAbstract::doParse in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php

File

vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php, line 430

Class

ParserAbstract

Namespace

PhpParser

Code

protected function getErrorMessage(int $symbol, int $state) : string {
    $expectedString = '';
    if ($expected = $this->getExpectedTokens($state)) {
        $expectedString = ', expecting ' . implode(' or ', $expected);
    }
    return 'Syntax error, unexpected ' . $this->symbolToName[$symbol] . $expectedString;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal