Skip to content

Commit eb1e7f6

Browse files
authored
Merge pull request #7977 from kenjis/fix-CLI-prompt-msg
fix: CLI prompt validation message
2 parents 49d3421 + cbeb86f commit eb1e7f6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

system/CLI/CLI.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static function init()
179179
* Named options must be in the following formats:
180180
* php index.php user -v --v -name=John --name=John
181181
*
182-
* @param string $prefix You may specify a string with which to prompt the user.
182+
* @param string|null $prefix You may specify a string with which to prompt the user.
183183
*/
184184
public static function input(?string $prefix = null): string
185185
{
@@ -210,9 +210,9 @@ public static function input(?string $prefix = null): string
210210
* // Do not provide options but requires a valid email
211211
* $email = CLI::prompt('What is your email?', null, 'required|valid_email');
212212
*
213-
* @param string $field Output "field" question
214-
* @param array|string $options String to a default value, array to a list of options (the first option will be the default value)
215-
* @param array|string $validation Validation rules
213+
* @param string $field Output "field" question
214+
* @param array|string $options String to a default value, array to a list of options (the first option will be the default value)
215+
* @param array|string|null $validation Validation rules
216216
*
217217
* @return string The user input
218218
*
@@ -258,7 +258,7 @@ public static function prompt(string $field, $options = null, $validation = null
258258
$input = trim(static::input()) ?: $default;
259259

260260
if ($validation) {
261-
while (! static::validate(trim($field), $input, $validation)) {
261+
while (! static::validate('"' . trim($field) . '"', $input, $validation)) {
262262
$input = static::prompt($field, $options, $validation);
263263
}
264264
}
@@ -448,7 +448,7 @@ public static function print(string $text = '', ?string $foreground = null, ?str
448448
}
449449

450450
/**
451-
* Outputs a string to the cli on it's own line.
451+
* Outputs a string to the cli on its own line.
452452
*
453453
* @return void
454454
*/
@@ -574,10 +574,10 @@ public static function clearScreen()
574574
* Returns the given text with the correct color codes for a foreground and
575575
* optionally a background color.
576576
*
577-
* @param string $text The text to color
578-
* @param string $foreground The foreground color
579-
* @param string $background The background color
580-
* @param string $format Other formatting to apply. Currently only 'underline' is understood
577+
* @param string $text The text to color
578+
* @param string $foreground The foreground color
579+
* @param string|null $background The background color
580+
* @param string|null $format Other formatting to apply. Currently only 'underline' is understood
581581
*
582582
* @return string The color coded string
583583
*/
@@ -834,7 +834,7 @@ public static function showProgress($thisStep = 1, int $totalSteps = 10)
834834
* width.
835835
*
836836
* If an int is passed into $pad_left, then all strings after the first
837-
* will padded with that many spaces to the left. Useful when printing
837+
* will pad with that many spaces to the left. Useful when printing
838838
* short descriptions that need to start on an existing line.
839839
*/
840840
public static function wrap(?string $string = null, int $max = 0, int $padLeft = 0): string

0 commit comments

Comments
 (0)