Added token type and value to error message

Added the given token type and value to the error message in case that the token after '.' is neither a name  nor a number.
This commit is contained in:
Kamyar Mirzavaziri
2022-02-11 20:52:25 +03:30
committed by Fabien Potencier
parent 65bedae131
commit 6c8da65b74
+1 -1
View File
@@ -488,7 +488,7 @@ class ExpressionParser
}
}
} else {
throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext());
throw new SyntaxError(sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), Token::typeToEnglish($token->getType())), $lineno, $stream->getSourceContext());
}
if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {