Fix isset in ForLoopNode

Even though the code works perfectly fine, PHPStan doesn't understand it.

Since we want to work with `revindex` and `revindex0`, we can better check for their
existence, instead of `length`.
This commit is contained in:
Ruud Kamphuis
2024-09-06 09:42:11 +02:00
parent b1cdda25c6
commit 2b887e64d5
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ class ForLoopNode extends Node
->write("++\$context['loop']['index0'];\n")
->write("++\$context['loop']['index'];\n")
->write("\$context['loop']['first'] = false;\n")
->write("if (isset(\$context['loop']['length'])) {\n")
->write("if (isset(\$context['loop']['revindex0'], \$context['loop']['revindex'])) {\n")
->indent()
->write("--\$context['loop']['revindex0'];\n")
->write("--\$context['loop']['revindex'];\n")