From 7834a80390aa317a8aaa53699ecfb91de3c8ea64 Mon Sep 17 00:00:00 2001 From: Valeriy Seregin Date: Tue, 12 Jan 2021 15:38:03 +0300 Subject: [PATCH 1/2] Fix type hinting for prompt function --- lib/cli/Streams.php | 2 +- lib/cli/cli.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cli/Streams.php b/lib/cli/Streams.php index 85e2929..b6fc727 100755 --- a/lib/cli/Streams.php +++ b/lib/cli/Streams.php @@ -156,7 +156,7 @@ public static function input( $format = null, $hide = false ) { * @return string The users input. * @see cli\input() */ - public static function prompt( $question, $default = null, $marker = ': ', $hide = false ) { + public static function prompt( $question, $default = false, $marker = ': ', $hide = false ) { if( $default && strpos( $question, '[' ) === false ) { $question .= ' [' . $default . ']'; } diff --git a/lib/cli/cli.php b/lib/cli/cli.php index 6aeb867..e4afebb 100755 --- a/lib/cli/cli.php +++ b/lib/cli/cli.php @@ -94,7 +94,7 @@ function input( $format = null ) { * continue displaying until input is received. * * @param string $question The question to ask the user. - * @param string $default A default value if the user provides no input. + * @param bool|string $default A default value if the user provides no input. * @param string $marker A string to append to the question and default value on display. * @param boolean $hide If the user input should be hidden * @return string The users input. From 0c0416288b18670163bfeb801ca2f5a40043548d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 2 Nov 2023 15:29:34 +0100 Subject: [PATCH 2/2] Make type more precise --- lib/cli/cli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli/cli.php b/lib/cli/cli.php index e4afebb..86756cb 100755 --- a/lib/cli/cli.php +++ b/lib/cli/cli.php @@ -94,7 +94,7 @@ function input( $format = null ) { * continue displaying until input is received. * * @param string $question The question to ask the user. - * @param bool|string $default A default value if the user provides no input. + * @param string|false $default A default value if the user provides no input. Default false. * @param string $marker A string to append to the question and default value on display. * @param boolean $hide If the user input should be hidden * @return string The users input.