Is $step an array? The doc type hint says mixed, but this line assumes array (or string if $type can be one character). Please either type hint array and change the doc type hint to array, or add some handling for it not to be an array.