Use correct lineno for ForElseNode

It should take the line number of the `{% else %}` block.
This commit is contained in:
Ruud Kamphuis
2025-02-07 14:48:08 +01:00
parent 8432946eee
commit a84e602b4f
+2 -1
View File
@@ -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;
}