Skip to content

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
@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