@@ -32,7 +32,7 @@ class Interact extends Show
3232 /**
3333 * read line from CLI input
3434 *
35- * @param mixed $message
35+ * @param mixed|null $message
3636 * @param bool $nl
3737 * @param array $opts
3838 * [
@@ -41,31 +41,31 @@ class Interact extends Show
4141 *
4242 * @return string
4343 */
44- public static function readln ($ message = null , bool $ nl = false , array $ opts = []): string
44+ public static function readln (mixed $ message = null , bool $ nl = false , array $ opts = []): string
4545 {
4646 return Cli::readln ($ message , $ nl , $ opts );
4747 }
4848
4949 /**
5050 * 读取输入信息
5151 *
52- * @param mixed $message 若不为空,则先输出文本
52+ * @param mixed|null $message 若不为空,则先输出文本
5353 * @param bool $nl true 会添加换行符 false 原样输出,不添加换行符
5454 *
5555 * @return string
5656 */
57- public static function readRow ($ message = null , bool $ nl = false ): string
57+ public static function readRow (mixed $ message = null , bool $ nl = false ): string
5858 {
5959 return Cli::readln ($ message , $ nl );
6060 }
6161
6262 /**
63- * @param null| mixed $message
63+ * @param mixed|null $message
6464 * @param bool $nl
6565 *
6666 * @return string
6767 */
68- public static function readFirst ($ message = null , bool $ nl = false ): string
68+ public static function readFirst (mixed $ message = null , bool $ nl = false ): string
6969 {
7070 return Cli::readFirst ($ message , $ nl );
7171 }
@@ -78,14 +78,14 @@ public static function readFirst($message = null, bool $nl = false): string
7878 * alias of the `select()`
7979 *
8080 * @param string $description 说明
81- * @param string| array $options 选项数据
81+ * @param array|string $options 选项数据
8282 * @param null $default 默认选项
8383 * @param bool $allowExit 有退出选项 默认 true
8484 * @param array $opts
8585 *
8686 * @return string
8787 */
88- public static function select (string $ description , $ options , $ default = null , bool $ allowExit = true , array $ opts = []): string
88+ public static function select (string $ description , array | string $ options , $ default = null , bool $ allowExit = true , array $ opts = []): string
8989 {
9090 return self ::choice ($ description , $ options , $ default , $ allowExit , $ opts );
9191 }
@@ -94,7 +94,7 @@ public static function select(string $description, $options, $default = null, bo
9494 * Choose one of several options
9595 *
9696 * @param string $description
97- * @param string| array $options Option data
97+ * @param array|string $options Option data
9898 * e.g
9999 * [
100100 * // option => value
@@ -107,7 +107,7 @@ public static function select(string $description, $options, $default = null, bo
107107 *
108108 * @return string
109109 */
110- public static function choice (string $ description , $ options , $ default = null , bool $ allowExit = true , array $ opts = []): string
110+ public static function choice (string $ description , array | string $ options , $ default = null , bool $ allowExit = true , array $ opts = []): string
111111 {
112112 return Choose::one ($ description , $ options , $ default , $ allowExit , $ opts );
113113 }
@@ -116,13 +116,13 @@ public static function choice(string $description, $options, $default = null, bo
116116 * alias of the `multiSelect()`
117117 *
118118 * @param string $description
119- * @param string| array $options
120- * @param null| mixed $default
119+ * @param array|string $options
120+ * @param mixed|null $default
121121 * @param bool $allowExit
122122 *
123123 * @return array
124124 */
125- public static function checkbox (string $ description , $ options , $ default = null , bool $ allowExit = true ): array
125+ public static function checkbox (string $ description , array | string $ options , mixed $ default = null , bool $ allowExit = true ): array
126126 {
127127 return self ::multiSelect ($ description , $ options , $ default , $ allowExit );
128128 }
@@ -131,13 +131,13 @@ public static function checkbox(string $description, $options, $default = null,
131131 * List multiple options and allow multiple selections
132132 *
133133 * @param string $description
134- * @param string| array $options
135- * @param null| mixed $default
134+ * @param array|string $options
135+ * @param mixed|null $default
136136 * @param bool $allowExit
137137 *
138138 * @return array
139139 */
140- public static function multiSelect (string $ description , $ options , $ default = null , bool $ allowExit = true ): array
140+ public static function multiSelect (string $ description , array | string $ options , mixed $ default = null , bool $ allowExit = true ): array
141141 {
142142 return Checkbox::select ($ description , $ options , $ default , $ allowExit );
143143 }
0 commit comments