Skip to content

Commit e4a2695

Browse files
committed
chore: update some for format message render
1 parent cd448f2 commit e4a2695

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/Component/Interact/Choose.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111

1212
use Inhere\Console\Console;
1313
use Inhere\Console\Util\Show;
14+
use Toolkit\Cli\Cli;
1415
use function array_key_exists;
16+
use function array_keys;
1517
use function explode;
18+
use function implode;
1619
use function is_array;
1720
use function trim;
1821

@@ -51,7 +54,7 @@ public static function one(string $description, $options, $default = null, bool
5154

5255
// If default option is error
5356
if (null !== $default && !isset($options[$default])) {
54-
Show::error("The default option [{$default}] don't exists.", true);
57+
Show::error("The default option [$default] don't exists.", true);
5558
}
5659

5760
if ($allowExit) {
@@ -75,6 +78,7 @@ public static function one(string $description, $options, $default = null, bool
7578

7679
// error, allow try again once.
7780
if (!array_key_exists($r, $options)) {
81+
Cli::warn('[WARN] input must in the list: ' . implode(',', array_keys($options)));
7882
goto beginChoice;
7983
}
8084

src/Concern/StyledOutputAwareTrait.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
*
6161
* @method Generator counterTxt($msg = 'Pending ', $ended = false)
6262
*
63-
* @method confirm(string $question, bool $default = true): bool
64-
* @method unConfirm(string $question, bool $default = true): bool
63+
* @method bool confirm(string $question, bool $default = true)
64+
* @method bool unConfirm(string $question, bool $default = true)
6565
* @method string select(string $description, $options, $default = null, bool $allowExit = true, array $opts = [])
66-
* @method checkbox(string $description, $options, $default = null, bool $allowExit = true): array
67-
* @method ask(string $question, string $default = '', Closure $validator = null): string
68-
* @method askPassword(string $prompt = 'Enter Password:'): string
66+
* @method array checkbox(string $description, $options, $default = null, bool $allowExit = true)
67+
* @method string ask(string $question, string $default = '', Closure $validator = null)
68+
* @method string askPassword(string $prompt = 'Enter Password:')
6969
* @see Interact
7070
*/
7171
trait StyledOutputAwareTrait

src/Util/FormatUtil.php

+4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
use function array_merge;
2020
use function array_shift;
2121
use function explode;
22+
use function get_class;
2223
use function implode;
2324
use function is_array;
2425
use function is_bool;
2526
use function is_int;
2627
use function is_numeric;
28+
use function is_object;
2729
use function is_scalar;
2830
use function rtrim;
2931
use function str_repeat;
@@ -272,6 +274,8 @@ public static function spliceKeyValue(array $data, array $opts = []): string
272274
}
273275

274276
$value = rtrim($temp, ' ,') . ']';
277+
// } elseif (is_object($value)) {
278+
// $value = get_class($value);
275279
} elseif (is_bool($value)) {
276280
$value = $value ? '(True)' : '(False)';
277281
} else { // to string.

0 commit comments

Comments
 (0)