You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was merged into the 3.x branch.
Discussion
----------
Simplify EscaperNodeVisitor code
This PR simplifies how we escape the ternary operator, and simplifies the whole strategy.
Instead of replacing the `PrintNode`s, we instead "just" wrap the inner expressions.
For the ternary operator, the `InlinePrint` expression is useless and even weird as printing something in the middle of an expression looks very wrong. This is not done anymore and the node is deprecated.
Overall, this PR makes fewer changes to the Node tree which should make things use a bit less memory.
Commits
-------
02cec77 Simplify EscaperNodeVisitor code
Copy file name to clipboardExpand all lines: src/Node/Expression/InlinePrint.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -24,9 +24,7 @@ final class InlinePrint extends AbstractExpression
24
24
*/
25
25
publicfunction__construct(Node$node, int$lineno)
26
26
{
27
-
if (!$nodeinstanceof AbstractExpression) {
28
-
trigger_deprecation('twig/twig', '3.15', 'Not passing a "%s" instance to the "node" argument of "%s" is deprecated ("%s" given).', AbstractExpression::class, static::class, get_class($node));
29
-
}
27
+
trigger_deprecation('twig/twig', '3.16', \sprintf('The "%s" class is deprecated with no replacement.', static::class));
0 commit comments