Skip to content

Commit

Permalink
Use reduce() from the reduceWithKeys() because they're identical (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ivanov committed Apr 21, 2021
1 parent 03f5531 commit fd0864a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Illuminate/Collections/Traits/EnumeratesValues.php
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit fd0864a

Please sign in to comment.