Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 21, 2023
2 parents 5c47140 + cf021e5 commit e06f97e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Illuminate/Collections/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ public static function shuffle($array, $seed = null)
return $array;
}

if (empty($array)) {
return [];
}

$keys = array_keys($array);

for ($i = count($keys) - 1; $i > 0; $i--) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '10.1.0';
const VERSION = '10.1.1';

/**
* The base path for the Laravel installation.
Expand Down
5 changes: 5 additions & 0 deletions tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,11 @@ public function testShuffle()
$this->assertTrue($dontMatch, 'Shuffled array should not have the same order.');
}

public function testEmptyShuffle()
{
$this->assertEquals([], Arr::shuffle([]));
}

public function testSort()
{
$unsorted = [
Expand Down

0 comments on commit e06f97e

Please sign in to comment.