Skip to content

Commit 56f9c2d

Browse files
committed
fix: TypeError in promptByMultipleKeys()
1 parent 35a295c commit 56f9c2d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

system/CLI/CLI.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ public static function promptByMultipleKeys(string $text, array $options): array
330330
CLI::write($text);
331331
CLI::printKeysAndValues($options);
332332
CLI::newLine();
333-
$input = static::prompt($extraOutput) ?: 0; // 0 is default
333+
334+
$input = static::prompt($extraOutput);
335+
$input = ($input === '') ? '0' : $input; // 0 is default
334336

335337
// validation
336338
while (true) {
@@ -349,7 +351,9 @@ public static function promptByMultipleKeys(string $text, array $options): array
349351
if (! $pattern || $maxOptions < $maxInput) {
350352
static::error('Please select correctly.');
351353
CLI::newLine();
352-
$input = static::prompt($extraOutput) ?: 0;
354+
355+
$input = static::prompt($extraOutput);
356+
$input = ($input === '') ? '0' : $input;
353357
} else {
354358
break;
355359
}

0 commit comments

Comments
 (0)