@@ -77,20 +77,14 @@ protected static function parseArgument(string $token)
7777 {
7878 [$ token , $ description ] = static ::extractDescription ($ token );
7979
80- switch (true ) {
81- case str_ends_with ($ token , '?* ' ):
82- return new InputArgument (trim ($ token , '?* ' ), InputArgument::IS_ARRAY , $ description );
83- case str_ends_with ($ token , '* ' ):
84- return new InputArgument (trim ($ token , '* ' ), InputArgument::IS_ARRAY | InputArgument::REQUIRED , $ description );
85- case str_ends_with ($ token , '? ' ):
86- return new InputArgument (trim ($ token , '? ' ), InputArgument::OPTIONAL , $ description );
87- case preg_match ('/(.+)\=\*(.+)/ ' , $ token , $ matches ):
88- return new InputArgument ($ matches [1 ], InputArgument::IS_ARRAY , $ description , preg_split ('/,\s?/ ' , $ matches [2 ]));
89- case preg_match ('/(.+)\=(.+)/ ' , $ token , $ matches ):
90- return new InputArgument ($ matches [1 ], InputArgument::OPTIONAL , $ description , $ matches [2 ]);
91- default :
92- return new InputArgument ($ token , InputArgument::REQUIRED , $ description );
93- }
80+ return match (true ) {
81+ str_ends_with ($ token , '?* ' ) => new InputArgument (trim ($ token , '?* ' ), InputArgument::IS_ARRAY , $ description ),
82+ str_ends_with ($ token , '* ' ) => new InputArgument (trim ($ token , '* ' ), InputArgument::IS_ARRAY | InputArgument::REQUIRED , $ description ),
83+ str_ends_with ($ token , '? ' ) => new InputArgument (trim ($ token , '? ' ), InputArgument::OPTIONAL , $ description ),
84+ (bool ) preg_match ('/(.+)\=\*(.+)/ ' , $ token , $ matches ) => new InputArgument ($ matches [1 ], InputArgument::IS_ARRAY , $ description , preg_split ('/,\s?/ ' , $ matches [2 ])),
85+ (bool ) preg_match ('/(.+)\=(.+)/ ' , $ token , $ matches ) => new InputArgument ($ matches [1 ], InputArgument::OPTIONAL , $ description , $ matches [2 ]),
86+ default => new InputArgument ($ token , InputArgument::REQUIRED , $ description ),
87+ };
9488 }
9589
9690 /**
0 commit comments