diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index cf190aa8a464..22fd2f9dde9c 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -1144,14 +1144,14 @@ public function shuffle($seed = null) if (is_null($seed)) { shuffle($items); - } else { - srand($seed); - - usort($items, function () { - return rand(-1, 1); - }); } + srand($seed); + + usort($items, function () { + return rand(-1, 1); + }); + return new static($items); } @@ -1548,9 +1548,9 @@ public function offsetSet($key, $value) { if (is_null($key)) { $this->items[] = $value; - } else { - $this->items[$key] = $value; } + + $this->items[$key] = $value; } /**