mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 04:16:28 +00:00
Remove obsolete code
This commit is contained in:
@@ -302,11 +302,12 @@ final class CoreExtension extends AbstractExtension
|
||||
{
|
||||
return [
|
||||
[
|
||||
'not' => ['precedence' => 50, 'precedence_change' => new OperatorPrecedenceChange('twig/twig', '3.15', 70), 'class' => NotUnary::class],
|
||||
'not' => ['precedence' => 70, 'class' => NotUnary::class],
|
||||
'-' => ['precedence' => 500, 'class' => NegUnary::class],
|
||||
'+' => ['precedence' => 500, 'class' => PosUnary::class],
|
||||
],
|
||||
[
|
||||
'??' => ['precedence' => 5, 'class' => NullCoalesceExpression::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT],
|
||||
'or' => ['precedence' => 10, 'class' => OrBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT],
|
||||
'xor' => ['precedence' => 12, 'class' => XorBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT],
|
||||
'and' => ['precedence' => 15, 'class' => AndBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT],
|
||||
@@ -338,7 +339,6 @@ final class CoreExtension extends AbstractExtension
|
||||
'is' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT],
|
||||
'is not' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT],
|
||||
'**' => ['precedence' => 200, 'class' => PowerBinary::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT],
|
||||
'??' => ['precedence' => 300, 'precedence_change' => new OperatorPrecedenceChange('twig/twig', '3.15', 5), 'class' => NullCoalesceExpression::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
*, /, //, and % will have a higher precedence over not in Twig 4.0
|
||||
--DEPRECATION--
|
||||
Since twig/twig 3.15: Add explicit parentheses around the "not" unary operator to avoid behavior change in the next major version as its precedence will change in "index.twig" at line 2.
|
||||
--TEMPLATE--
|
||||
{{ not 1 * 2 }}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
@@ -2,8 +2,9 @@
|
||||
*, /, //, and % will have a higher precedence over not in Twig 4.0
|
||||
--TEMPLATE--
|
||||
{{ (not 1) * 2 }}
|
||||
{{ (not 1 * 2) }}
|
||||
{{ not 1 * 2 }}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
0
|
||||
0
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Twig supports the ?? operator
|
||||
--DEPRECATION--
|
||||
Since twig/twig 3.15: Add explicit parentheses around the "??" binary operator to avoid behavior change in the next major version as its precedence will change in "index.twig" at line 4.
|
||||
Since twig/twig 3.15: Add explicit parentheses around the "??" binary operator to avoid behavior change in the next major version as its precedence will change in "index.twig" at line 5.
|
||||
--TEMPLATE--
|
||||
{{ nope ?? nada ?? 'OK' -}} {# no deprecation as the operators have the same precedence #}
|
||||
|
||||
{{ 1 + nope ?? nada ?? 2 }}
|
||||
{{ 1 + nope ?? 3 + nada ?? 2 }}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
OK
|
||||
3
|
||||
6
|
||||
@@ -13,6 +13,7 @@ Twig supports the ?? operator
|
||||
{{ nope ?? (nada ?? 'OK') }}
|
||||
{{ 1 + (nope ?? (nada ?? 2)) }}
|
||||
{{ 1 + (nope ?? 3) + (nada ?? 2) }}
|
||||
{{ nope ?? nada ?? 2 }}
|
||||
--DATA--
|
||||
return ['bar' => 'OK', 'foo' => ['bar' => 'OK']]
|
||||
--EXPECT--
|
||||
@@ -28,3 +29,4 @@ OK
|
||||
OK
|
||||
3
|
||||
6
|
||||
2
|
||||
Reference in New Issue
Block a user