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.5] Modify except collection method to have a single dimension collection #22802

Closed

Conversation

amaelftah
Copy link
Contributor

this PR reverts #22399 , the reason is to make the method API consistent

in the documentation except() method accepts single dimension array of keys , not multi dimension array

$collection = collect(['product_id' => 1, 'price' => 100, 'discount' => false]);

//will return all the $collection which is wrong
$collection->except(['price'  => 50, 'discount' => true]);

//same will happen if we do this
 $collection->except(collect(['price' ,'discount' ]));

so in my opinion if we are passing array of keys , we should also pass collection of keys

$collection->except(['price' ,'discount']);

$collection->except(collect(['price' ,'discount']));

@taylorotwell
Copy link
Member

This is a breaking change.

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