Skip to content

Commit 42f57c6

Browse files
authored
Merge pull request #124 from php-api-clients/a-bit-looser-array-merging
A bit looser array merging
2 parents 45340e7 + 89c1902 commit 42f57c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Gatherer/Property.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private static function generateExampleData(mixed $exampleData, PropertyType $ty
6161
{
6262
if ($type->type === 'array') {
6363
if ($type->payload instanceof \ApiClients\Tools\OpenApiClientGenerator\Representation\Schema) {
64-
$exampleData = ArrayMerger::doMerge($type->payload->example, $exampleData ?? [], ArrayMerger::FLAG_OVERWRITE_NUMERIC_KEY);
64+
$exampleData = ArrayMerger::doMerge($type->payload->example, $exampleData ?? [], ArrayMerger::FLAG_OVERWRITE_NUMERIC_KEY | ArrayMerger::FLAG_ALLOW_SCALAR_TO_ARRAY_CONVERSION);
6565
} else if ($type->payload instanceof PropertyType) {
6666
$exampleData = self::generateExampleData($exampleData, $type->payload, $propertyName);
6767
}
@@ -70,7 +70,7 @@ private static function generateExampleData(mixed $exampleData, PropertyType $ty
7070

7171

7272
if ($type->payload instanceof \ApiClients\Tools\OpenApiClientGenerator\Representation\Schema) {
73-
return ArrayMerger::doMerge($type->payload->example, is_array($exampleData) ? $exampleData : [], ArrayMerger::FLAG_OVERWRITE_NUMERIC_KEY);
73+
return ArrayMerger::doMerge($type->payload->example, is_array($exampleData) ? $exampleData : [], ArrayMerger::FLAG_OVERWRITE_NUMERIC_KEY | ArrayMerger::FLAG_ALLOW_SCALAR_TO_ARRAY_CONVERSION);
7474
} else if ($exampleData === null && $type->type=== 'scalar') {
7575
if ($type->payload === 'int') {
7676
return 13;

0 commit comments

Comments
 (0)