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] Collection as parameter on Collection::except #22399

Merged
merged 4 commits into from
Dec 13, 2017

Conversation

glorand
Copy link
Contributor

@glorand glorand commented Dec 12, 2017

$collectionA = collect(['first' => 'First', 'last' => 'Last']);
$collectionB = collect(['first' => 'First']);
#Instead of 
$collectionC = $collectionA->except($collectionB->keys()->all());
#you can use in this way
$collectionC = $collectionA->except($collectionB);

* @return static
*/
public function except($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
if ($keys instanceof Collection) {
$keys = $keys->keys()->items;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't items protected?

Copy link
Contributor

@lagbox lagbox Dec 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but it has direct access to it, I would suppose the method call would be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lagbox all() method? probably yes

@GrahamCampbell GrahamCampbell changed the title Collection as parameter on Collection::except [5.5] Collection as parameter on Collection::except Dec 12, 2017
@taylorotwell
Copy link
Member

taylorotwell commented Jan 16, 2018

Reverting this sense it doesn't make any sense and is a breaking change.

@glorand glorand deleted the collection-except branch January 17, 2018 08:04
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