Skip to content

Commit 0cdf150

Browse files
committed
Use SORT_REGULAR if data is array
1 parent b7ef065 commit 0cdf150

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/SchemaFaker/ArrayFaker.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
use function array_unique;
1212
use function count;
13+
use function is_array;
14+
15+
use const SORT_REGULAR;
16+
use const SORT_STRING;
1317

1418
/**
1519
* @internal
@@ -52,7 +56,7 @@ public static function generate(Schema $schema, Options $options): array
5256
continue;
5357
}
5458

55-
$uniqueData = array_unique($fakeData);
59+
$uniqueData = array_unique($fakeData, is_array($fakeData[0]) ? SORT_REGULAR : SORT_STRING);
5660

5761
if (count($uniqueData) >= count($fakeData)) {
5862
continue;

0 commit comments

Comments
 (0)