@@ -645,8 +645,13 @@ public function find($name)
645
645
// filter out aliases for commands which are already on the list
646
646
if (\count ($ commands ) > 1 ) {
647
647
$ commandList = $ this ->commandLoader ? array_merge (array_flip ($ this ->commandLoader ->getNames ()), $ this ->commands ) : $ this ->commands ;
648
- $ commands = array_unique (array_filter ($ commands , function ($ nameOrAlias ) use ($ commandList , $ commands , &$ aliases ) {
649
- $ commandName = $ commandList [$ nameOrAlias ] instanceof Command ? $ commandList [$ nameOrAlias ]->getName () : $ nameOrAlias ;
648
+ $ commands = array_unique (array_filter ($ commands , function ($ nameOrAlias ) use (&$ commandList , $ commands , &$ aliases ) {
649
+ if (!$ commandList [$ nameOrAlias ] instanceof Command) {
650
+ $ commandList [$ nameOrAlias ] = $ this ->commandLoader ->get ($ nameOrAlias );
651
+ }
652
+
653
+ $ commandName = $ commandList [$ nameOrAlias ]->getName ();
654
+
650
655
$ aliases [$ nameOrAlias ] = $ commandName ;
651
656
652
657
return $ commandName === $ nameOrAlias || !\in_array ($ commandName , $ commands );
@@ -662,10 +667,6 @@ public function find($name)
662
667
$ maxLen = max (Helper::strlen ($ abbrev ), $ maxLen );
663
668
}
664
669
$ abbrevs = array_map (function ($ cmd ) use ($ commandList , $ usableWidth , $ maxLen ) {
665
- if (!$ commandList [$ cmd ] instanceof Command) {
666
- $ commandList [$ cmd ] = $ this ->commandLoader ->get ($ cmd );
667
- }
668
-
669
670
if ($ commandList [$ cmd ]->isHidden ()) {
670
671
return false ;
671
672
8000
}
0 commit comments