File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,7 +101,18 @@ public function __construct(string $name = null)
101101 {
102102 $ this ->definition = new InputDefinition ();
103103
104- if (null !== $ name || null !== $ name = static ::getDefaultName ()) {
104+ if (null === $ name && null !== $ name = static ::getDefaultName ()) {
105+ $ aliases = explode ('| ' , $ name );
106+
107+ if ('' === $ name = array_shift ($ aliases )) {
108+ $ this ->setHidden (true );
109+ $ name = array_shift ($ aliases );
110+ }
111+
112+ $ this ->setAliases ($ aliases );
113+ }
114+
115+ if (null !== $ name ) {
105116 $ this ->setName ($ name );
106117 }
107118
Original file line number Diff line number Diff line change @@ -414,6 +414,13 @@ public function testCommandAttribute()
414414 {
415415 $ this ->assertSame ('|foo|f ' , Php8Command::getDefaultName ());
416416 $ this ->assertSame ('desc ' , Php8Command::getDefaultDescription ());
417+
418+ $ command = new Php8Command ();
419+
420+ $ this ->assertSame ('foo ' , $ command ->getName ());
421+ $ this ->assertSame ('desc ' , $ command ->getDescription ());
422+ $ this ->assertTrue ($ command ->isHidden ());
423+ $ this ->assertSame (['f ' ], $ command ->getAliases ());
417424 }
418425}
419426
You can’t perform that action at this time.
0 commit comments