You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for some clarification about the intended behavior for toArray(). As per the current project documentation, the toArray() method (emphasis mine):
Converts the collection to array recursively.
A recursive operation implies that a collection of collections would be converted into an array of arrays; however, the current behavior just calls iterator_to_array on the top level, so that an array of collections is returned. If this is the intended behavior, the documentation should be updated to indicate that the operation is not actually recursive.
I can see places where the current behavior is desirable, but it would be nice to be able to reliable cast a whole collection into an array in a single operation without having to manually recurse the iterator. I could see this functionally added in a BC friendly way as toArray($recursive = false);
Happy to help, just need to know what direction this method is supposed to go in.
The text was updated successfully, but these errors were encountered:
I'm looking for some clarification about the intended behavior for
toArray()
. As per the current project documentation, thetoArray()
method (emphasis mine):A recursive operation implies that a collection of collections would be converted into an array of arrays; however, the current behavior just calls
iterator_to_array
on the top level, so that an array of collections is returned. If this is the intended behavior, the documentation should be updated to indicate that the operation is not actually recursive.I can see places where the current behavior is desirable, but it would be nice to be able to reliable cast a whole collection into an array in a single operation without having to manually recurse the iterator. I could see this functionally added in a BC friendly way as
toArray($recursive = false
);Happy to help, just need to know what direction this method is supposed to go in.
The text was updated successfully, but these errors were encountered: