diff --git a/src/Illuminate/Collections/Traits/EnumeratesValues.php b/src/Illuminate/Collections/Traits/EnumeratesValues.php index 869e37146b63..3200a2e5dc3f 100644 --- a/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ b/src/Illuminate/Collections/Traits/EnumeratesValues.php @@ -785,21 +785,6 @@ class_basename(static::class), gettype($result) return $result; } - /** - * Reduce an associative collection to a single value. - * - * @template TReduceWithKeysInitial - * @template TReduceWithKeysReturnType - * - * @param callable(TReduceWithKeysInitial|TReduceWithKeysReturnType, TValue): TReduceWithKeysReturnType $callback - * @param TReduceWithKeysInitial $initial - * @return TReduceWithKeysReturnType - */ - public function reduceWithKeys(callable $callback, $initial = null) - { - return $this->reduce($callback, $initial); - } - /** * Create a collection of all elements that do not pass a given truth test. * diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 000d0539634a..e012eb39f959 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -3963,20 +3963,6 @@ public function testReduce($collection) })); } - /** - * @dataProvider collectionClassProvider - */ - public function testReduceWithKeys($collection) - { - $data = new $collection([ - 'foo' => 'bar', - 'baz' => 'qux', - ]); - $this->assertSame('foobarbazqux', $data->reduceWithKeys(function ($carry, $element, $key) { - return $carry .= $key.$element; - })); - } - /** * @dataProvider collectionClassProvider */ diff --git a/types/Support/Collection.php b/types/Support/Collection.php index 0c335a25bce5..9b510ff57083 100644 --- a/types/Support/Collection.php +++ b/types/Support/Collection.php @@ -547,21 +547,6 @@ return 1; }, 0)); -assertType('int', $collection - ->reduceWithKeys(function ($null, $user) { - assertType('User', $user); - assertType('int|null', $null); - - return 1; - })); -assertType('int', $collection - ->reduceWithKeys(function ($int, $user) { - assertType('User', $user); - assertType('int', $int); - - return 1; - }, 0)); - assertType('Illuminate\Support\Collection', $collection::make([1])->replace([1])); assertType('Illuminate\Support\Collection', $collection->replace([new User])); diff --git a/types/Support/LazyCollection.php b/types/Support/LazyCollection.php index 83e1c9f43dd3..1d7b1672a6c9 100644 --- a/types/Support/LazyCollection.php +++ b/types/Support/LazyCollection.php @@ -546,21 +546,6 @@ return 1; }, 0)); -assertType('int', $collection - ->reduceWithKeys(function ($null, $user) { - assertType('User', $user); - assertType('int|null', $null); - - return 1; - })); -assertType('int', $collection - ->reduceWithKeys(function ($int, $user) { - assertType('User', $user); - assertType('int', $int); - - return 1; - }, 0)); - assertType('Illuminate\Support\LazyCollection', $collection::make([1])->replace([1])); assertType('Illuminate\Support\LazyCollection', $collection->replace([new User]));