Skip to content

Commit fd0864a

Browse files
Use reduce() from the reduceWithKeys() because they're identical (#37074)
1 parent 03f5531 commit fd0864a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Illuminate/Collections/Traits/EnumeratesValues.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -753,13 +753,7 @@ public function reduce(callable $callback, $initial = null)
753753
*/
754754
public function reduceWithKeys(callable $callback, $initial = null)
755755
{
756-
$result = $initial;
757-
758-
foreach ($this as $key => $value) {
759-
$result = $callback($result, $value, $key);
760-
}
761-
762-
return $result;
756+
return $this->reduce($callback, $initial);
763757
}
764758

765759
/**

0 commit comments

Comments
 (0)