From 08af31bbfab1180c3dcfa120ba66767d32259d48 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 17 Dec 2022 14:14:59 +0100 Subject: [PATCH] fix: prevent wrapping and unwrapping arrays when it's not needed --- src/Collection.php | 2 +- src/Operation/Forget.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 1efd2bc9a..6d055738b 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -310,7 +310,7 @@ public function foldRight1(callable $callback): mixed public function forget(mixed ...$keys): CollectionInterface { - return new self((new Operation\Forget())()(...$keys), [$this]); + return new self((new Operation\Forget())()($keys), [$this]); } public function frequency(): CollectionInterface diff --git a/src/Operation/Forget.php b/src/Operation/Forget.php index acd1c18a0..ec23c449e 100644 --- a/src/Operation/Forget.php +++ b/src/Operation/Forget.php @@ -18,17 +18,17 @@ final class Forget extends AbstractOperation { /** - * @return Closure(TKey...): Closure(iterable): Generator + * @return Closure(array): Closure(iterable): Generator */ public function __invoke(): Closure { return /** - * @param TKey ...$keys + * @param array $keys * * @return Closure(iterable): Generator */ - static fn (mixed ...$keys): Closure => (new Filter())()( + static fn (array $keys): Closure => (new Filter())()( /** * @param T $value * @param TKey $key