Skip to content

Commit

Permalink
Use SORT_REGULAR if data is array
Browse files Browse the repository at this point in the history
  • Loading branch information
canvural committed May 13, 2022
1 parent b7ef065 commit 0cdf150
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/SchemaFaker/ArrayFaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

use function array_unique;
use function count;
use function is_array;

use const SORT_REGULAR;
use const SORT_STRING;

/**
* @internal
Expand Down Expand Up @@ -52,7 +56,7 @@ public static function generate(Schema $schema, Options $options): array
continue;
}

$uniqueData = array_unique($fakeData);
$uniqueData = array_unique($fakeData, is_array($fakeData[0]) ? SORT_REGULAR : SORT_STRING);

if (count($uniqueData) >= count($fakeData)) {
continue;
Expand Down

0 comments on commit 0cdf150

Please sign in to comment.