[ ' [], 'error_levels' => [ 'MixedAssignment', 'UndefinedThisPropertyAssignment', ], ], 'intersectionIterator' => [ '&\Countable $object */ function doSomethingUseful($object) : void { echo count($object); foreach ($object as $foo) {} }' ], 'arrayIteratorIteration' => [ 'items[] = $item; } /** * @return \ArrayIterator */ public function getIterator(): \ArrayIterator { return new \ArrayIterator($this->items); } } $collection = new Collection(); $collection->add(new Item()); foreach ($collection as $item) { echo $item->prop; }' ], 'foreachIntersectionTraversable' => [ ' */ $c = null; foreach ($c as $i) {}', ], ]; } /** * @return array */ public function providerFileCheckerInvalidCodeParse() { return [ 'continueOutsideLoop' => [ ' 'ContinueOutsideLoop', ], 'invalidIterator' => [ ' 'InvalidIterator', ], 'rawObjectIteration' => [ ' 5) { $arr[] = new A; } else { $arr = new B; } foreach ($arr as $a) { bar($a); }', 'error_message' => 'RawObjectIteration', ], ]; } }