diff --git a/src/ExpressionParser/InfixExpressionParserInterface.php b/src/ExpressionParser/InfixExpressionParserInterface.php index 8d0ac674c..4641ef815 100644 --- a/src/ExpressionParser/InfixExpressionParserInterface.php +++ b/src/ExpressionParser/InfixExpressionParserInterface.php @@ -11,12 +11,16 @@ namespace Twig\ExpressionParser; +use Twig\Error\SyntaxError; use Twig\Node\Expression\AbstractExpression; use Twig\Parser; use Twig\Token; interface InfixExpressionParserInterface extends ExpressionParserInterface { + /** + * @throws SyntaxError + */ public function parse(Parser $parser, AbstractExpression $left, Token $token): AbstractExpression; public function getAssociativity(): InfixAssociativity; diff --git a/src/ExpressionParser/PrefixExpressionParserInterface.php b/src/ExpressionParser/PrefixExpressionParserInterface.php index 587997c51..8e39dad37 100644 --- a/src/ExpressionParser/PrefixExpressionParserInterface.php +++ b/src/ExpressionParser/PrefixExpressionParserInterface.php @@ -11,11 +11,15 @@ namespace Twig\ExpressionParser; +use Twig\Error\SyntaxError; use Twig\Node\Expression\AbstractExpression; use Twig\Parser; use Twig\Token; interface PrefixExpressionParserInterface extends ExpressionParserInterface { + /** + * @throws SyntaxError + */ public function parse(Parser $parser, Token $token): AbstractExpression; } diff --git a/src/Parser.php b/src/Parser.php index acc1a4dc9..af54f13b2 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -76,6 +76,9 @@ class Parser return \sprintf('__internal_parse_%d', $this->varNameSalt++); } + /** + * @throws SyntaxError + */ public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode { $vars = get_object_vars($this); @@ -158,6 +161,9 @@ class Parser } } + /** + * @throws SyntaxError + */ public function subparse($test, bool $dropNeedle = false): Node { $lineno = $this->getCurrentToken()->getLine();