-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[8.x] Add hasAny() Method to Collections #39155
[8.x] Add hasAny() Method to Collections #39155
Conversation
Ping @JosephSilber |
Looks good, though it needs a test verifying that it's actually lazy. |
I have added the requested test. I'll fully admit that lazy collections aren't a strength of mine, but I think that I did it right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Just suggesting an additional test case.
I'm not sure why that test is failing - seems unrelated to this PR? I ran the tests locally on PHP8 and it worked fine. |
@intrepidws restarted the build for ya. |
* WIP * Test to verify hasAny() method is actually lazy * Additional test to verify hasAny() method is actually lazy
This PR adds support for a
hasAny()
method to collections. A similar method already exists as an array helper, in the MessageBag class and in the InteractsWithInput class. Since it already exists in all of those places, I think it makes sense to add it to the Collection classes for full parity.This example would return true:
While this would return false: