File tree 2 files changed +19
-1
lines changed
src/Symfony/Component/Console
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,18 @@ public function __construct(string $name = null)
101
101
{
102
102
$ this ->definition = new InputDefinition ();
103
103
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 ) {
105
116
$ this ->setName ($ name );
106
117
}
107
118
Original file line number Diff line number Diff line change @@ -414,6 +414,13 @@ public function testCommandAttribute()
414
414
{
415
415
$ this ->assertSame ('|foo|f ' , Php8Command::getDefaultName ());
416
416
$ 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 ());
417
424
}
418
425
}
419
426
You can’t perform that action at this time.
0 commit comments