Skip to content

Commit

Permalink
Fix enumerable methods parameters seen wrong by Laravel
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Dec 1, 2023
1 parent f61000f commit 5b9e328
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Concerns/EnumerableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function through(callable $through): static
{
$cloned = clone $this;

$cloned->items = $cloned->items->map($through);
$cloned->items = $cloned->items->map(...func_get_args());

return $cloned;
}
Expand All @@ -35,7 +35,7 @@ public function through(callable $through): static
*/
public function map(callable $map): static
{
return $this->through($map);
return $this->through(...func_get_args());
}

/**
Expand All @@ -47,7 +47,7 @@ public function filter(callable $filter): static
{
$cloned = clone $this;

$cloned->items = $cloned->items->filter($filter);
$cloned->items = $cloned->items->filter(...func_get_args());

return $cloned;
}
Expand All @@ -61,7 +61,7 @@ public function reject(callable $filter): static
{
$cloned = clone $this;

$cloned->items = $cloned->items->reject($filter);
$cloned->items = $cloned->items->reject(...func_get_args());

return $cloned;
}
Expand All @@ -76,7 +76,7 @@ public function reject(callable $filter): static
*/
public function first(callable|null $callback = null, $default = null)
{
return $this->items->first($callback, $default);
return $this->items->first(...func_get_args());
}

/**
Expand All @@ -89,7 +89,7 @@ public function first(callable|null $callback = null, $default = null)
*/
public function last(callable|null $callback = null, $default = null)
{
return $this->items->last($callback, $default);
return $this->items->last(...func_get_args());
}

/**
Expand All @@ -99,7 +99,7 @@ public function last(callable|null $callback = null, $default = null)
*/
public function each(callable $callback): static
{
$this->items->each($callback);
$this->items->each(...func_get_args());

return $this;
}
Expand All @@ -120,7 +120,7 @@ public function where(string $key, mixed $operator = null, mixed $value = null):
{
$cloned = clone $this;

$cloned->items = $cloned->items->where($key, $operator, $value);
$cloned->items = $cloned->items->where(...func_get_args());

return $cloned;
}
Expand All @@ -136,7 +136,7 @@ public function where(string $key, mixed $operator = null, mixed $value = null):
*/
public function reduce(callable $callback, mixed $initial = null)
{
return $this->items->reduce($callback, $initial);
return $this->items->reduce(...func_get_args());
}

/**
Expand Down

0 comments on commit 5b9e328

Please sign in to comment.