From 6c8da65b7432c5d5b6b7e4b3c48f097eeaed692f Mon Sep 17 00:00:00 2001 From: Kamyar Mirzavaziri Date: Fri, 11 Feb 2022 20:52:25 +0330 Subject: [PATCH] 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. --- src/ExpressionParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ExpressionParser.php b/src/ExpressionParser.php index 1d9c8768738..b0bcf10809f 100644 --- a/src/ExpressionParser.php +++ b/src/ExpressionParser.php @@ -488,7 +488,7 @@ public function parseSubscriptExpression($node) } } } 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'))) {