File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,20 +66,12 @@ public static function getCommandNames(): array
6666 }
6767
6868 $ reflection = new ReflectionClass (self ::class);
69- $ attribute = $ reflection ->getAttributes (AsCommand::class)[0 ] ?? null ;
70-
71- if (null === $ attribute ) {
72- return $ commandNames = [];
73- }
74-
75- $ arguments = $ attribute ->getArguments ();
76- $ commandName = $ arguments ['name ' ] ?? $ arguments [0 ] ?? '' ;
77- $ aliases = $ arguments ['aliases ' ] ?? $ arguments [2 ] ?? [];
78- $ commandNames = [$ commandName , ...((array ) $ aliases )];
69+ $ arguments = $ reflection ->getAttributes (AsCommand::class)[0 ]->getArguments ();
70+ $ commandNames = [$ arguments ['name ' ], ...$ arguments ['aliases ' ]];
7971
8072 return $ commandNames = array_values (array_filter (
8173 $ commandNames ,
82- static fn (mixed $ commandName ): bool => \is_string ( $ commandName ) && '' !== $ commandName ,
74+ static fn (string $ commandName ): bool => '' !== $ commandName ,
8375 ));
8476 }
8577
You can’t perform that action at this time.
0 commit comments