@@ -72,24 +72,28 @@ private function registerAnnotationCommands(): void
7272 $ commands = AnnotationCollector::getMethodsByAnnotation (AsCommandAnnotation::class);
7373
7474 foreach ($ commands as $ metadata ) {
75- /** @var AsCommandAnnotation $annotation */
76- $ annotation = $ metadata ['annotation ' ];
77- $ command = new AsCommand (
78- $ this ->container ,
79- $ annotation ->signature ,
80- $ metadata ['class ' ],
81- $ metadata ['method ' ],
82- );
83-
84- if ($ annotation ->description ) {
85- $ command ->setDescription ($ annotation ->description );
75+ /** @var \Hyperf\Di\Annotation\MultipleAnnotation $multiAnnotation */
76+ $ multiAnnotation = $ metadata ['annotation ' ];
77+ /** @var AsCommandAnnotation[] $annotations */
78+ $ annotations = $ multiAnnotation ->toAnnotations ();
79+ foreach ($ annotations as $ annotation ) {
80+ $ command = new AsCommand (
81+ $ this ->container ,
82+ $ annotation ->signature ,
83+ $ metadata ['class ' ],
84+ $ metadata ['method ' ],
85+ );
86+
87+ if ($ annotation ->description ) {
88+ $ command ->setDescription ($ annotation ->description );
89+ }
90+ if ($ annotation ->aliases ) {
91+ $ command ->setAliases ($ annotation ->aliases );
92+ }
93+
94+ $ this ->container ->set ($ annotation ->id , $ command );
95+ $ this ->appendConfig ('commands ' , $ annotation ->id );
8696 }
87- if ($ annotation ->aliases ) {
88- $ command ->setAliases ($ annotation ->aliases );
89- }
90-
91- $ this ->container ->set ($ annotation ->id , $ command );
92- $ this ->appendConfig ('commands ' , $ annotation ->id );
9397 }
9498 }
9599
0 commit comments