You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
default => thrownewSyntaxError(\sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()),
344
+
default => thrownewSyntaxError(\sprintf('Unexpected token "%s" of value "%s".', $token->toEnglish(), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()),
345
345
};
346
346
break;
347
347
348
-
case Token::OPERATOR_TYPE:
348
+
case$token->test(Token::OPERATOR_TYPE):
349
349
if (preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) {
350
350
// in this context, string operators are variable names
351
351
$this->parser->getStream()->next();
@@ -359,7 +359,7 @@ public function parsePrimaryExpression()
359
359
360
360
// no break
361
361
default:
362
-
thrownewSyntaxError(\sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
362
+
thrownewSyntaxError(\sprintf('Unexpected token "%s" of value "%s".', $token->toEnglish(), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
363
363
}
364
364
365
365
return$this->parsePostfixExpression($node);
@@ -491,7 +491,7 @@ public function parseMappingExpression()
491
491
} else {
492
492
$current = $stream->getCurrent();
493
493
494
-
thrownewSyntaxError(\sprintf('A mapping key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext());
494
+
thrownewSyntaxError(\sprintf('A mapping key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', $current->toEnglish(), $current->getValue()), $current->getLine(), $stream->getSourceContext());
495
495
}
496
496
497
497
$stream->expect(Token::PUNCTUATION_TYPE, ':', 'A mapping key must be followed by a colon (:)');
@@ -508,7 +508,7 @@ public function parsePostfixExpression($node)
508
508
{
509
509
while (true) {
510
510
$token = $this->parser->getCurrentToken();
511
-
if (Token::PUNCTUATION_TYPE == $token->getType()) {
511
+
if ($token->test(Token::PUNCTUATION_TYPE)) {
512
512
if ('.' == $token->getValue() || '[' == $token->getValue()) {
513
513
$node = $this->parseSubscriptExpression($node);
514
514
} elseif ('|' == $token->getValue()) {
@@ -944,13 +944,13 @@ private function parseSubscriptExpressionDot(Node $node): AbstractExpression
thrownewSyntaxError(\sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), Token::typeToEnglish($token->getType())), $token->getLine(), $stream->getSourceContext());
953
+
thrownewSyntaxError(\sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), $token->toEnglish()), $token->getLine(), $stream->getSourceContext());
0 commit comments