From a84e602b4f411bca0e6058e4fb4afbb1edcbe7a0 Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Fri, 7 Feb 2025 14:48:08 +0100 Subject: [PATCH] Use correct lineno for ForElseNode It should take the line number of the `{% else %}` block. --- src/TokenParser/ForTokenParser.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TokenParser/ForTokenParser.php b/src/TokenParser/ForTokenParser.php index 632737b8f..3e08b22fa 100644 --- a/src/TokenParser/ForTokenParser.php +++ b/src/TokenParser/ForTokenParser.php @@ -42,8 +42,9 @@ final class ForTokenParser extends AbstractTokenParser $stream->expect(Token::BLOCK_END_TYPE); $body = $this->parser->subparse([$this, 'decideForFork']); if ('else' == $stream->next()->getValue()) { + $elseLineno = $stream->getCurrent()->getLine(); $stream->expect(Token::BLOCK_END_TYPE); - $else = new ForElseNode($this->parser->subparse([$this, 'decideForEnd'], true), $stream->getCurrent()->getLine()); + $else = new ForElseNode($this->parser->subparse([$this, 'decideForEnd'], true), $elseLineno); } else { $else = null; }