Skip to content

Commit

Permalink
Added token type and value to error message
Browse files Browse the repository at this point in the history
Added the given token type and value to the error message in case that the token after '.' is neither a name  nor a number.
  • Loading branch information
kmirzavaziri authored and fabpot committed Mar 25, 2022
1 parent 65bedae commit 6c8da65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ExpressionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))) {
Expand Down

0 comments on commit 6c8da65

Please sign in to comment.