Skip to content

Commit 7f12e87

Browse files
committed
bug #4572 Use correct lineno for ForElseNode (ruudk)
This PR was merged into the 3.x branch. Discussion ---------- Use correct lineno for ForElseNode It should take the line number of the `{% else %}` block. Commits ------- a84e602 Use correct lineno for ForElseNode
2 parents 8432946 + a84e602 commit 7f12e87

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/TokenParser/ForTokenParser.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ public function parse(Token $token): Node
4242
$stream->expect(Token::BLOCK_END_TYPE);
4343
$body = $this->parser->subparse([$this, 'decideForFork']);
4444
if ('else' == $stream->next()->getValue()) {
45+
$elseLineno = $stream->getCurrent()->getLine();
4546
$stream->expect(Token::BLOCK_END_TYPE);
46-
$else = new ForElseNode($this->parser->subparse([$this, 'decideForEnd'], true), $stream->getCurrent()->getLine());
47+
$else = new ForElseNode($this->parser->subparse([$this, 'decideForEnd'], true), $elseLineno);
4748
} else {
4849
$else = null;
4950
}

0 commit comments

Comments
 (0)