From 5b9e32824a17dd7c91499075fbae882398bd4220 Mon Sep 17 00:00:00 2001 From: Ruben Van Assche Date: Fri, 1 Dec 2023 15:22:12 +0100 Subject: [PATCH] Fix enumerable methods parameters seen wrong by Laravel --- src/Concerns/EnumerableMethods.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Concerns/EnumerableMethods.php b/src/Concerns/EnumerableMethods.php index 1a123a3d..a2eac9b5 100644 --- a/src/Concerns/EnumerableMethods.php +++ b/src/Concerns/EnumerableMethods.php @@ -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; } @@ -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()); } /** @@ -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; } @@ -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; } @@ -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()); } /** @@ -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()); } /** @@ -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; } @@ -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; } @@ -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()); } /**