Fix precedence rules

This commit is contained in:
Fabien Potencier
2025-02-03 22:22:16 +01:00
parent 0cb5c0e8d0
commit 8ff19090f3
29 changed files with 457 additions and 186 deletions
@@ -13,6 +13,7 @@ namespace Twig\ExpressionParser\Infix;
use Twig\Error\SyntaxError;
use Twig\ExpressionParser\AbstractExpressionParser;
use Twig\ExpressionParser\ExpressionParserDescriptionInterface;
use Twig\ExpressionParser\InfixAssociativity;
use Twig\ExpressionParser\InfixExpressionParserInterface;
use Twig\Lexer;
@@ -30,7 +31,7 @@ use Twig\Token;
/**
* @internal
*/
final class DotExpressionParser extends AbstractExpressionParser implements InfixExpressionParserInterface
final class DotExpressionParser extends AbstractExpressionParser implements InfixExpressionParserInterface, ExpressionParserDescriptionInterface
{
use ArgumentsTrait;
@@ -81,9 +82,14 @@ final class DotExpressionParser extends AbstractExpressionParser implements Infi
return '.';
}
public function getDescription(): string
{
return 'Get an attribute on a variable';
}
public function getPrecedence(): int
{
return 300;
return 512;
}
public function getAssociativity(): InfixAssociativity