@@ -125,6 +125,7 @@ private function parseRoute(Analysis $analysis, array $controllerClasses)
125
125
]);
126
126
$ analysis ->addAnnotation ($ infoAnnotation , $ context );
127
127
}
128
+ $ factory = \phpDocumentor \Reflection \DocBlockFactory::createInstance ();
128
129
// 遍历 imi 控制器类
129
130
foreach ($ controllerClasses as $ controllerClass )
130
131
{
@@ -163,10 +164,18 @@ private function parseRoute(Analysis $analysis, array $controllerClasses)
163
164
$ requestPath = $ controllerAnnotation ->prefix . $ requestPath ;
164
165
}
165
166
166
- $ factory = \phpDocumentor \Reflection \DocBlockFactory::createInstance ();
167
- $ docblock = $ factory ->create ($ refMethod ->getDocComment ());
168
- /** @var \phpDocumentor\Reflection\DocBlock\Tags\Param[] $docParams */
169
- $ docParams = $ docblock ->getTagsByName ('param ' );
167
+ $ comment = $ refMethod ->getDocComment ();
168
+ if (false === $ comment )
169
+ {
170
+ $ comment = '' ;
171
+ $ docParams = [];
172
+ }
173
+ else
174
+ {
175
+ $ docblock = $ factory ->create ($ comment );
176
+ /** @var \phpDocumentor\Reflection\DocBlock\Tags\Param[] $docParams */
177
+ $ docParams = $ docblock ->getTagsByName ('param ' );
178
+ }
170
179
171
180
// method
172
181
$ requestMethods = (array ) ($ route ->method ?? 'GET ' );
@@ -232,7 +241,6 @@ private function parseRoute(Analysis $analysis, array $controllerClasses)
232
241
]);
233
242
}
234
243
235
- $ comment = false === $ refMethod ->getDocComment () ? $ refMethod ->getDocComment () : '' ;
236
244
$ methodContext = new Context ([
237
245
'comment ' => $ comment ,
238
246
'filename ' => $ refMethod ->getFileName (),
0 commit comments