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

Fix unless code comment #53529

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Fix unless code comment #53529

merged 1 commit into from
Nov 15, 2024

Conversation

fritz-c
Copy link
Contributor

@fritz-c fritz-c commented Nov 15, 2024

The existing code comment was copied from when, and therefore mistakenly explains the callback is called when the value is truthy.

And just for reference, here was my own sanity check, done in tinker:

> collect([1,2,3,4])->unless(false,fn($a)=>$a->prepend(62362))
= Illuminate\Support\Collection {#7422
    all: [
      62362,
      1,
      2,
      3,
      4,
    ],
  }

> collect([1,2,3,4])->unless(true,fn($a)=>$a->prepend(62362))
= Illuminate\Support\Collection {#7351
    all: [
      1,
      2,
      3,
      4,
    ],
  }

The existing code comment was copied from `when`, and therefore mistakenly explains the callback is called when the value is truthy.
@taylorotwell taylorotwell merged commit 100d583 into laravel:11.x Nov 15, 2024
33 checks passed
@fritz-c fritz-c deleted the patch-1 branch November 15, 2024 15: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