Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Collections/Enumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ public function random($number = null);
* @template TReduceInitial
* @template TReduceReturnType
*
* @param callable(TReduceInitial|TReduceReturnType, TValue): TReduceReturnType $callback
* @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback
* @param TReduceInitial $initial
* @return TReduceReturnType
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Collections/Traits/EnumeratesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ function ($carry, $pipe) {
* @template TReduceInitial
* @template TReduceReturnType
*
* @param callable(TReduceInitial|TReduceReturnType, TValue): TReduceReturnType $callback
* @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback
* @param TReduceInitial $initial
* @return TReduceReturnType
*/
Expand Down Expand Up @@ -808,7 +808,7 @@ class_basename(static::class), gettype($result)
* @template TReduceWithKeysInitial
* @template TReduceWithKeysReturnType
*
* @param callable(TReduceWithKeysInitial|TReduceWithKeysReturnType, TValue): TReduceWithKeysReturnType $callback
* @param callable(TReduceWithKeysInitial|TReduceWithKeysReturnType, TValue, TKey): TReduceWithKeysReturnType $callback
* @param TReduceWithKeysInitial $initial
* @return TReduceWithKeysReturnType
*/
Expand Down
16 changes: 16 additions & 0 deletions types/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,14 @@
assertType('User', $user);
assertType('int', $int);

return 1;
}, 0));
assertType('int', $collection
->reduce(function ($int, $user, $key) {
assertType('User', $user);
assertType('int', $int);
assertType('int', $key);

return 1;
}, 0));

Expand All @@ -559,6 +567,14 @@
assertType('User', $user);
assertType('int', $int);

return 1;
}, 0));
assertType('int', $collection
->reduceWithKeys(function ($int, $user, $key) {
assertType('User', $user);
assertType('int', $int);
assertType('int', $key);

return 1;
}, 0));

Expand Down