mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-09 05:15:35 +00:00
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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user