Fix version

This commit is contained in:
Fabien Potencier
2025-02-14 08:47:54 +01:00
parent 251c0b5da9
commit 79d828b09d
10 changed files with 46 additions and 46 deletions
+8 -8
View File
@@ -218,9 +218,9 @@ Parser
3.12.
* The ``Twig\Parser::getExpressionParser()`` method is deprecated as of Twig
3.20, use ``Twig\Parser::parseExpression()`` instead.
3.21, use ``Twig\Parser::parseExpression()`` instead.
* The ``Twig\ExpressionParser`` class is deprecated as of Twig 3.20:
* The ``Twig\ExpressionParser`` class is deprecated as of Twig 3.21:
* ``parseExpression()``, use ``Parser::parseExpression()``
* ``parsePrimaryExpression()``, use ``Parser::parseExpression()``
@@ -247,7 +247,7 @@ Token
* The ``Token::getType()`` method is deprecated as of Twig 3.19, use
``Token::test()`` instead.
* The ``Token::ARROW_TYPE`` constant is deprecated as of Twig 3.20, the arrow
* The ``Token::ARROW_TYPE`` constant is deprecated as of Twig 3.21, the arrow
``=>`` is now an operator (``Token::OPERATOR_TYPE``).
* The ``Token::PUNCTUATION_TYPE`` with values ``(``, ``[``, ``|``, ``.``,
@@ -378,7 +378,7 @@ Node
Operators
---------
* An operator precedence must be part of the [0, 512] range as of Twig 3.20.
* An operator precedence must be part of the [0, 512] range as of Twig 3.21.
* The ``.`` operator allows accessing class constants as of Twig 3.15.
This can be a BC break if you don't use UPPERCASE constant names.
@@ -436,10 +436,10 @@ Operators
{{ (not 1) * 2 }} {# this is equivalent to what Twig 4.x will do without the parentheses #}
* Using the ``|`` operator in an expression with ``+`` or ``-`` without explicit
parentheses to clarify precedence triggers a deprecation as of Twig 3.20 (in
parentheses to clarify precedence triggers a deprecation as of Twig 3.21 (in
Twig 4.0, ``|`` will have a higher precedence than ``+`` and ``-``).
For example, the following expression will trigger a deprecation in Twig 3.20::
For example, the following expression will trigger a deprecation in Twig 3.21::
{{ -1|abs }}
@@ -452,7 +452,7 @@ Operators
{{ (-1)|abs }} {# this is equivalent to what Twig 4.x will do without the parentheses #}
* The ``Twig\Extension\ExtensionInterface::getOperators()`` method is deprecated
as of Twig 3.20, use ``Twig\Extension\ExtensionInterface::getExpressionParsers()``
as of Twig 3.21, use ``Twig\Extension\ExtensionInterface::getExpressionParsers()``
instead:
Before:
@@ -474,5 +474,5 @@ Operators
];
}
* The ``Twig\OperatorPrecedenceChange`` class is deprecated as of Twig 3.20,
* The ``Twig\OperatorPrecedenceChange`` class is deprecated as of Twig 3.21,
use ``Twig\ExpressionParser\PrecedenceChange`` instead.
+1 -1
View File
@@ -16,7 +16,7 @@ separator using the additional arguments:
{{ 9800.333|number_format(2, '.', ',') }}
To format negative numbers, wrap the previous statement with parentheses (note
that as of Twig 3.20, not using parentheses is deprecated as the filter
that as of Twig 3.21, not using parentheses is deprecated as the filter
operator will change precedence in Twig 4.0):
.. code-block:: twig
+25 -25
View File
@@ -36,16 +36,16 @@ use Twig\Node\Nodes;
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
class ExpressionParser
{
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public const OPERATOR_LEFT = 1;
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public const OPERATOR_RIGHT = 2;
@@ -53,7 +53,7 @@ class ExpressionParser
private Parser $parser,
private Environment $env,
) {
trigger_deprecation('twig/twig', '3.20', 'Class "%s" is deprecated, use "Parser::parseExpression()" instead.', __CLASS__);
trigger_deprecation('twig/twig', '3.21', 'Class "%s" is deprecated, use "Parser::parseExpression()" instead.', __CLASS__);
}
public function parseExpression($precedence = 0)
@@ -62,27 +62,27 @@ class ExpressionParser
trigger_deprecation('twig/twig', '3.15', 'Passing a second argument ($allowArrow) to "%s()" is deprecated.', __METHOD__);
}
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated, use "Parser::parseExpression()" instead.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated, use "Parser::parseExpression()" instead.', __METHOD__);
return $this->parser->parseExpression((int) $precedence);
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parsePrimaryExpression()
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
return $this->parseExpression();
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseStringExpression()
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
return $this->parseExpression();
}
@@ -98,11 +98,11 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseSequenceExpression()
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
return $this->parseExpression();
}
@@ -118,21 +118,21 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseMappingExpression()
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
return $this->parseExpression();
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parsePostfixExpression($node)
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
while (true) {
$token = $this->parser->getCurrentToken();
@@ -153,11 +153,11 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseSubscriptExpression($node)
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
$parsers = new \ReflectionProperty($this->parser, 'parsers');
@@ -169,11 +169,11 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseFilterExpression($node)
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
$this->parser->getStream()->next();
@@ -181,11 +181,11 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseFilterExpressionRaw($node)
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
$parsers = new \ReflectionProperty($this->parser, 'parsers');
@@ -294,11 +294,11 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20, use "AbstractTokenParser::parseAssignmentExpression()" instead
* @deprecated since Twig 3.21, use "AbstractTokenParser::parseAssignmentExpression()" instead
*/
public function parseAssignmentExpression()
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated, use "AbstractTokenParser::parseAssignmentExpression()" instead.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated, use "AbstractTokenParser::parseAssignmentExpression()" instead.', __METHOD__);
$stream = $this->parser->getStream();
$targets = [];
@@ -321,11 +321,11 @@ class ExpressionParser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function parseMultitargetExpression()
{
trigger_deprecation('twig/twig', '3.20', 'The "%s()" method is deprecated.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'The "%s()" method is deprecated.', __METHOD__);
$targets = [];
while (true) {
+1 -1
View File
@@ -50,7 +50,7 @@ final class ExpressionParsers implements \IteratorAggregate
{
foreach ($parsers as $parser) {
if ($parser->getPrecedence() > 512 || $parser->getPrecedence() < 0) {
trigger_deprecation('twig/twig', '3.20', 'Precedence for "%s" must be between 0 and 512, got %d.', $parser->getName(), $parser->getPrecedence());
trigger_deprecation('twig/twig', '3.21', 'Precedence for "%s" must be between 0 and 512, got %d.', $parser->getName(), $parser->getPrecedence());
// throw new \InvalidArgumentException(\sprintf('Precedence for "%s" must be between 0 and 512, got %d.', $parser->getName(), $parser->getPrecedence()));
}
$interface = $parser instanceof PrefixExpressionParserInterface ? PrefixExpressionParserInterface::class : InfixExpressionParserInterface::class;
@@ -75,7 +75,7 @@ final class FilterExpressionParser extends AbstractExpressionParser implements I
public function getPrecedenceChange(): ?PrecedenceChange
{
return new PrecedenceChange('twig/twig', '3.20', 300);
return new PrecedenceChange('twig/twig', '3.21', 300);
}
public function getAssociativity(): InfixAssociativity
+2 -2
View File
@@ -510,7 +510,7 @@ final class ExtensionSet
}
if (\count($expressionParsers)) {
trigger_deprecation('twig/twig', '3.20', \sprintf('Extension "%s" uses the old signature for "getOperators()", please implement "getExpressionParsers()" instead.', $extension::class));
trigger_deprecation('twig/twig', '3.21', \sprintf('Extension "%s" uses the old signature for "getOperators()", please implement "getExpressionParsers()" instead.', $extension::class));
$this->expressionParsers->add($expressionParsers);
}
@@ -518,7 +518,7 @@ final class ExtensionSet
private function convertInfixExpressionParser(string $nodeClass, string $operator, int $precedence, InfixAssociativity $associativity, ?PrecedenceChange $precedenceChange, array $aliases, callable $callable): InfixExpressionParserInterface
{
trigger_deprecation('twig/twig', '3.20', \sprintf('Using a non-ExpressionParserInterface object to define the "%s" binary operator is deprecated.', $operator));
trigger_deprecation('twig/twig', '3.21', \sprintf('Using a non-ExpressionParserInterface object to define the "%s" binary operator is deprecated.', $operator));
return new class($nodeClass, $operator, $precedence, $associativity, $precedenceChange, $aliases, $callable) extends BinaryOperatorExpressionParser {
public function __construct(
+1 -1
View File
@@ -27,7 +27,7 @@ class OperatorPrecedenceChange extends PrecedenceChange
private string $version,
private int $newPrecedence,
) {
trigger_deprecation('twig/twig', '3.20', 'The "%s" class is deprecated since Twig 3.20. Use "%s" instead.', self::class, PrecedenceChange::class);
trigger_deprecation('twig/twig', '3.21', 'The "%s" class is deprecated since Twig 3.21. Use "%s" instead.', self::class, PrecedenceChange::class);
parent::__construct($package, $version, $newPrecedence);
}
+2 -2
View File
@@ -342,11 +342,11 @@ class Parser
}
/**
* @deprecated since Twig 3.20
* @deprecated since Twig 3.21
*/
public function getExpressionParser(): ExpressionParser
{
trigger_deprecation('twig/twig', '3.20', 'Method "%s()" is deprecated, use "parseExpression()" instead.', __METHOD__);
trigger_deprecation('twig/twig', '3.21', 'Method "%s()" is deprecated, use "parseExpression()" instead.', __METHOD__);
if (null === $this->expressionParser) {
$this->expressionParser = new ExpressionParser($this, $this->env);
+4 -4
View File
@@ -31,7 +31,7 @@ final class Token
public const INTERPOLATION_START_TYPE = 10;
public const INTERPOLATION_END_TYPE = 11;
/**
* @deprecated since Twig 3.20, "arrow" is now an operator
* @deprecated since Twig 3.21, "arrow" is now an operator
*/
public const ARROW_TYPE = 12;
public const SPREAD_TYPE = 13;
@@ -42,7 +42,7 @@ final class Token
private int $lineno,
) {
if (self::ARROW_TYPE === $type) {
trigger_deprecation('twig/twig', '3.20', 'The "%s" token type is deprecated, "arrow" is now an operator.', self::ARROW_TYPE);
trigger_deprecation('twig/twig', '3.21', 'The "%s" token type is deprecated, "arrow" is now an operator.', self::ARROW_TYPE);
}
}
@@ -70,7 +70,7 @@ final class Token
}
if (self::ARROW_TYPE === $type) {
trigger_deprecation('twig/twig', '3.20', 'The "%s" token type is deprecated, "arrow" is now an operator.', self::typeToEnglish(self::ARROW_TYPE));
trigger_deprecation('twig/twig', '3.21', 'The "%s" token type is deprecated, "arrow" is now an operator.', self::typeToEnglish(self::ARROW_TYPE));
return self::OPERATOR_TYPE === $this->type && '=>' === $this->value;
}
@@ -79,7 +79,7 @@ final class Token
if ($typeMatches && self::PUNCTUATION_TYPE === $type && \in_array($this->value, ['(', '[', '|', '.', '?', '?:']) && $values) {
foreach ((array) $values as $value) {
if (\in_array($value, ['(', '[', '|', '.', '?', '?:'])) {
trigger_deprecation('twig/twig', '3.20', 'The "%s" token is now an "%s" token instead of a "%s" one.', $this->value, self::typeToEnglish(self::OPERATOR_TYPE), $this->toEnglish());
trigger_deprecation('twig/twig', '3.21', 'The "%s" token is now an "%s" token instead of a "%s" one.', $this->value, self::typeToEnglish(self::OPERATOR_TYPE), $this->toEnglish());
break;
}
@@ -1,7 +1,7 @@
--TEST--
| will have a higher precedence over + and - in Twig 4.0
--DEPRECATION--
Since twig/twig 3.20: As the "|" infix operator will change its precedence in the next major version, add explicit parentheses to avoid behavior change in "index.twig" at line 2.
Since twig/twig 3.21: As the "|" infix operator will change its precedence in the next major version, add explicit parentheses to avoid behavior change in "index.twig" at line 2.
--TEMPLATE--
{{ -1|abs }}
--DATA--