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
Our previous mechanism of doing a "lookbehind" with twig
lead to array key warnings. Instead we now look ahead, which
is also valid from the perspective of twig, to determine if
more loops are ending than closing, and for break if enough
loops are ending to break out of.
// There should be more loops ending than starting, making loopCount negative
58
+
if ($loopCount >= 0) {
62
59
thrownewSyntaxError(
63
60
\ucfirst($this->getTag()) . ' tag is only allowed in \'for\' or \'foreach\' loops.',
64
61
$stream->getCurrent()->getLine(),
65
62
$stream->getSourceContext()
66
63
);
67
-
} elseif ($currentForLoop < $loopNumber) {
64
+
} elseif (\abs($loopCount) < $loopNumber) {
68
65
thrownewSyntaxError(
69
-
\ucfirst($this->getTag()) . ' tag uses a loop number higher than the actual loops in this context - you are using the number ' . $loopNumber . ' but in the given context the maximum number is ' . $currentForLoop . '.',
66
+
\ucfirst($this->getTag()) . ' tag uses a loop number higher than the actual loops in this context - you are using the number ' . $loopNumber . ' but in the given context the maximum number is ' . \abs($loopCount) . '.',
0 commit comments