Skip to content

Commit

Permalink
refactor: Remove variable assignation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Apr 20, 2021
1 parent d31df6f commit afe71bf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,13 +525,11 @@ public function map(callable ...$callbacks): CollectionInterface

public function match(callable $callback, ?callable $matcher = null): CollectionInterface
{
$matcher = $matcher ?? static fn (): bool => true;

// @todo: Rename this in next major version.
// We cannot use Match::class because PHP 8 has
// a new "match" function and we cannot use the same name.
// @See https://github.com/loophp/collection/issues/56
return new self(MatchOne::of()($matcher)($callback), $this->getIterator());
return new self(MatchOne::of()($matcher ?? static fn (): bool => true)($callback), $this->getIterator());
}

public function merge(iterable ...$sources): CollectionInterface
Expand Down

0 comments on commit afe71bf

Please sign in to comment.