Skip to content

Commit 21efcd9

Browse files
committed
Fixed doc example generator with null value
1 parent ce03840 commit 21efcd9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

util/GenerateDocExamples.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ function prettyPrintArray(array $input, int $space): string
138138
} else {
139139
if (is_string($value)) {
140140
$value = "'" . str_replace("'", "\'", $value) . "'";
141-
} if (is_bool($value)) {
141+
} elseif (is_bool($value)) {
142142
$value = $value ? 'true' : 'false';
143+
} elseif ($value === null) {
144+
$value = 'null';
143145
}
144146
$output .= sprintf("%s,\n", $value);
145147
}
@@ -194,5 +196,5 @@ function removeAllFiles(string $folder): void
194196
function printUsageMsg(): void
195197
{
196198
printf("Usage: php %s <PATH_TO_JSON>\n", basename(__FILE__));
197-
printf("where <PATH_TO_JSON> is the `alternatives_report.spec.json` path file\n");
199+
printf("where <PATH_TO_JSON> is the parsed alternative report json file\n");
198200
}

0 commit comments

Comments
 (0)