@@ -17,26 +17,21 @@ class Argument extends Parameter
1717 */
1818 protected function parse (string $ arg )
1919 {
20- $ this ->required = $ arg [0 ] === '< ' ;
21- $ this ->variadic = \strpos ($ arg , '... ' ) !== false ;
22- $ this ->name = $ name = \str_replace (['< ' , '> ' , '[ ' , '] ' , '. ' ], '' , $ arg );
20+ $ this ->name = $ name = \str_replace (['< ' , '> ' , '[ ' , '] ' , '. ' ], '' , $ arg );
2321
24- // Format is "name:default+value1,default+value2" ('+'' => ' ')!
22+ // Format is "name:default+value1,default+value2" ('+' => ' ')!
2523 if (\strpos ($ name , ': ' ) !== false ) {
2624 $ name = \str_replace ('+ ' , ' ' , $ name );
2725 list ($ this ->name , $ this ->default ) = \explode (': ' , $ name , 2 );
2826 }
27+
28+ $ this ->prepDefault ();
2929 }
3030
31- /**
32- * {@inheritdoc}
33- */
34- public function default ()
31+ protected function prepDefault ()
3532 {
36- if (! $ this ->variadic ) {
37- return $ this ->default ;
33+ if ($ this ->variadic && $ this -> default && ! \is_array ( $ this -> default ) ) {
34+ $ this -> default = \explode ( ' , ' , $ this ->default , 2 ) ;
3835 }
39-
40- return null === $ this ->default ? [] : \explode (', ' , $ this ->default );
4136 }
4237}
0 commit comments