@@ -645,8 +645,13 @@ public function find($name)
645645 // filter out aliases for commands which are already on the list
646646 if (\count ($ commands ) > 1 ) {
647647 $ 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+
650655 $ aliases [$ nameOrAlias ] = $ commandName ;
651656
652657 return $ commandName === $ nameOrAlias || !\in_array ($ commandName , $ commands );
@@ -662,10 +667,6 @@ public function find($name)
662667 $ maxLen = max (Helper::strlen ($ abbrev ), $ maxLen );
663668 }
664669 $ abbrevs = array_map (function ($ cmd ) use ($ commandList , $ usableWidth , $ maxLen ) {
665- if (!$ commandList [$ cmd ] instanceof Command) {
666- $ commandList [$ cmd ] = $ this ->commandLoader ->get ($ cmd );
667- }
668-
669670 if ($ commandList [$ cmd ]->isHidden ()) {
670671 return false ;
671672 }
0 commit comments