File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public function parse(Token $token): Node
1717 {
1818 $ stream = $ this ->parser ->getStream ();
1919
20- $ this ->parser -> getExpressionParser ()-> parseExpression ();
20+ $ this ->parseExpression ();
2121 $ this ->parseArguments ();
2222
2323 $ fakeParentToken = new Token (Token::STRING_TYPE , '__parent__ ' , $ token ->getLine ());
@@ -47,11 +47,22 @@ private function parseArguments(): void
4747 $ stream = $ this ->parser ->getStream ();
4848
4949 if (null !== $ stream ->nextIf (Token::NAME_TYPE , 'with ' )) {
50- $ this ->parser -> getExpressionParser ()-> parseExpression ();
50+ $ this ->parseExpression ();
5151 }
5252
5353 $ stream ->nextIf (Token::NAME_TYPE , 'only ' );
5454
5555 $ stream ->expect (Token::BLOCK_END_TYPE );
5656 }
57+
58+ private function parseExpression (): void
59+ {
60+ // @phpstan-ignore-next-line
61+ if (method_exists ($ this ->parser , 'parseExpression ' )) {
62+ // Since Twig 3.21
63+ $ this ->parser ->parseExpression ();
64+ } else {
65+ $ this ->parser ->getExpressionParser ()->parseExpression ();
66+ }
67+ }
5768}
You can’t perform that action at this time.
0 commit comments