Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toArray - Documented vs Current Behavior #57

Open
andysnell opened this issue Mar 7, 2019 · 0 comments
Open

toArray - Documented vs Current Behavior #57

andysnell opened this issue Mar 7, 2019 · 0 comments
Labels

Comments

@andysnell
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants