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

[9.x] Switch to null coalescing operator in Conditionable #40888

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

inxilpro
Copy link
Contributor

@inxilpro inxilpro commented Feb 9, 2022

This fixes #40877 but is technically a breaking change. Generally, I think this leads to more expected behavior, but it could be an issue for someone who currently expects that returning a falsy value will result in the conditionable object to be returned.

A more backwards-compatible approach might be to do an is_null($result) || $result === false check instead. I personally think the null coalesce is fine, but I just wanted to point it out.

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.

[9.x] Conditionable::when returns Collection when callback or default return empty value (e.g. 0)
3 participants