* Splits a list into sub-lists stored in an object, based on the result of calling a String-returning function on each element, and grouping the results according to values returned.
The expression return reduce(function(...., array(), $collection) could return the type Closure which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.