1.6.0
New sniff added: Moxio.PHP.DisallowImplicitIteratorToArrayWithUseKeys
. This sniff disallows calls to iterator_to_array()
without the $use_keys
argument being explicitly set. By default, iterator_to_array
uses the keys provided by the iterator. This behavior is often desired for associative arrays, but can cause unexpected results for 'list-like' arrays. Explicitly requiring the parameter to be set ensures that the developer has to think about which behavior is desired for the situation at hand. Thanks to @hollodotme for drawing our attention to this 'risky' default behavior.