From fd0864a71a0536906661074190f60d17d27eeae9 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Wed, 21 Apr 2021 21:03:16 +0300 Subject: [PATCH] Use `reduce()` from the `reduceWithKeys()` because they're identical (#37074) --- src/Illuminate/Collections/Traits/EnumeratesValues.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Illuminate/Collections/Traits/EnumeratesValues.php b/src/Illuminate/Collections/Traits/EnumeratesValues.php index bdeb7fde8a48..defe64935c1b 100644 --- a/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ b/src/Illuminate/Collections/Traits/EnumeratesValues.php @@ -753,13 +753,7 @@ public function reduce(callable $callback, $initial = null) */ public function reduceWithKeys(callable $callback, $initial = null) { - $result = $initial; - - foreach ($this as $key => $value) { - $result = $callback($result, $value, $key); - } - - return $result; + return $this->reduce($callback, $initial); } /**