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

[5.2] Allow collections to be created from objects that implement Traversable #14628

Merged
merged 2 commits into from
Aug 5, 2016

Conversation

timsweb
Copy link
Contributor

@timsweb timsweb commented Aug 4, 2016

As the title suggests. I'm making use of the Collection code via tightenco/collect, and I had a use case where my data was contained within an object that implements Iterator.

@GrahamCampbell GrahamCampbell changed the title Allow collections to be created from objects that implement Traversable [5.2] Allow collections to be created from objects that implement Traversable Aug 5, 2016
@taylorotwell taylorotwell merged commit 01cf96f into laravel:5.2 Aug 5, 2016
@GrahamCampbell
Copy link
Member

This is a breaking change is it not?

@timsweb
Copy link
Contributor Author

timsweb commented Aug 5, 2016

Well it’ll break for anyone who’s passing in an Traversable and expecting collect() to loop over it’s properties instead of ... iterating.

I think this is more fixing than breaking as this changes the behaviour to match foreach when encountering a Traversable.

tillkruss pushed a commit to tillkruss/framework that referenced this pull request Aug 30, 2016
…versable (laravel#14628)

* Allow collections to be created from objects that implement Traversable

* Style fix; remove exta space character
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants