PHP allows for not just having an (array/iterable object) variable in the "iterable" (before as) part, it also allows for those to be passed as an expression.
While this is surely more rare, it does mean that it is possible for an as keyword to exist in the expression.
This commit makes the Context::inForeachCondition() method more robust by explicitly skipping over array declarations while searching for the as keyword belonging to the foreach. This fixes the bug.
PHP allows for not just having an (array/iterable object) variable in the "iterable" (before as) part, it also allows for those to be passed as an expression.
While this is surely more rare, it does mean that it is possible for an
as
keyword to exist in the expression.This commit makes the
Context::inForeachCondition()
method more robust by explicitly skipping over array declarations while searching for theas
keyword belonging to theforeach
. This fixes the bug.Includes tests.