Fix compatibility layer

This commit is contained in:
Fabien Potencier
2025-08-17 19:23:48 +02:00
parent 9c94bfee41
commit 806049f7a2
+2 -2
View File
@@ -214,7 +214,7 @@ class ExpressionParser
{
trigger_deprecation('twig/twig', '3.19', \sprintf('The "%s()" method is deprecated, use "Twig\ExpressionParser\Infix\ArgumentsTrait::parseNamedArguments()" instead.', __METHOD__));
$parsePrimary = new \ReflectionMethod($this->parser, 'parsePrimary');
$parsePrimaryExpression = new \ReflectionMethod($this->parser, 'parsePrimaryExpression');
$namedArguments = false;
$definition = false;
@@ -263,7 +263,7 @@ class ExpressionParser
$name = $value->getAttribute('name');
if ($definition) {
$value = $parsePrimary->invoke($this->parser);
$value = $parsePrimaryExpression->invoke($this->parser);
if (!$this->checkConstantExpression($value)) {
throw new SyntaxError('A default value for an argument must be a constant (a boolean, a string, a number, a sequence, or a mapping).', $token->getLine(), $stream->getSourceContext());