Skip to content

Conversation

tvbeek
Copy link
Contributor

@tvbeek tvbeek commented May 3, 2018

See: #22090

This will change the result of the split function to return the requested amount of collections (except the total of items is less then the requested number)

Example
collect(['a', 'b', 'c', 'd'])->split(3);

// expected and new result
[['a', 'b'], ['c'], ['d']]

// result before this change
[['a', 'b'], ['c', 'd']]

It will change the split function and add 3 new tests to test some edge cases that are fixed with this change.

This was already provided for the 5.6 branch where @taylorotwell point out that he will not change this in a point release (See #24083 ). That is something that I understand.

I think it is good to change this in the next release or explain it in the documentation.

@tvbeek tvbeek changed the title Fix a unsuspected result from the split function in the Collection class [5.7] Fix a unsuspected result from the split function in the Collection class May 3, 2018
@taylorotwell taylorotwell merged commit 4a27f5a into laravel:master May 3, 2018
@tvbeek tvbeek deleted the fix_unsuspected_result_from_split_on_collection branch May 3, 2018 13:50
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.

2 participants