Skip to content

Commit 0222f79

Browse files
committed
fix error 'Failed to load API definition.'
1 parent a20d0df commit 0222f79

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Builder/Class_.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ private function buildMethodParams( $docParams, $httpMethod ){
147147
$swaggerParams = [];
148148

149149
foreach( $docParams as $paramDocBlock ){
150+
if( $paramDocBlock instanceof \phpDocumentor\Reflection\DocBlock\Tags\InvalidTag ){
151+
error_log( var_export($paramDocBlock, true) );
152+
continue;
153+
}
154+
150155
$variableName = $paramDocBlock->getVariableName();
151156

152157
// *号结尾的参数名标识必填字段
@@ -233,7 +238,9 @@ private function buildMethodResponses( $docReturns, & $produces ){
233238
];
234239
}
235240

236-
$produces = array_unique( $produces );
241+
if( $produces ) {
242+
$produces = array_unique( $produces );
243+
}
237244

238245
return $swaggerResponses;
239246
}

0 commit comments

Comments
 (0)