@@ -233,8 +233,8 @@ protected function generatePathInfo(string $methodName, array $httpMethodData, s
233233 {
234234 $ methodData = $ httpMethodData [Converter::KEY_METHOD ];
235235 $ uri = ucwords (str_replace (['/{ ' , '}/ ' , '{ ' , '} ' ], '/ ' , $ uri ), "/ " );
236-
237- $ operationId = ucfirst ($ methodName ). str_replace (['/ ' , '- ' ], '' , $ uri );
236+
237+ $ operationId = ucfirst ($ methodName ) . str_replace (['/ ' , '- ' ], '' , $ uri );
238238 $ pathInfo = [
239239 'tags ' => [$ tagName ],
240240 'description ' => $ methodData ['documentation ' ],
@@ -327,7 +327,7 @@ private function generateMethodParameters($httpMethodData, $operationId)
327327 if (!isset ($ parameterInfo ['type ' ])) {
328328 return [];
329329 }
330- $ description = isset ( $ parameterInfo ['documentation ' ]) ? $ parameterInfo [ ' documentation ' ] : null ;
330+ $ description = $ parameterInfo ['documentation ' ] ?? null ;
331331
332332 /** Get location of parameter */
333333 if (strpos ($ httpMethodData ['uri ' ], (string ) ('{ ' . $ parameterName . '} ' )) !== false ) {
@@ -432,11 +432,11 @@ protected function getObjectSchema($typeName, $description = '')
432432 if (!empty ($ description )) {
433433 $ result ['description ' ] = $ description ;
434434 }
435- $ trimedTypeName = rtrim ($ typeName , '[] ' );
435+ $ trimedTypeName = $ typeName !== null ? rtrim ($ typeName , '[] ' ) : '' ;
436436 if ($ simpleType = $ this ->getSimpleType ($ trimedTypeName )) {
437437 $ result ['items ' ] = ['type ' => $ simpleType ];
438438 } else {
439- if (strpos ($ typeName , '[] ' ) !== false ) {
439+ if ($ typeName && strpos ($ typeName , '[] ' ) !== false ) {
440440 $ result ['items ' ] = ['$ref ' => $ this ->getDefinitionReference ($ trimedTypeName )];
441441 } else {
442442 $ result = ['$ref ' => $ this ->getDefinitionReference ($ trimedTypeName )];
@@ -708,14 +708,14 @@ protected function getQueryParamNames($name, $type, $description, $prefix = '')
708708 // Primitive type or array of primitive types
709709 return [
710710 $ this ->handlePrimitive ($ name , $ prefix ) => [
711- 'type ' => substr ($ type , -2 ) === '[] ' ? $ type : $ this ->getSimpleType ($ type ),
711+ 'type ' => ( $ type && substr ($ type , -2 ) === '[] ' ) ? $ type : $ this ->getSimpleType ($ type ),
712712 'description ' => $ description
713713 ]
714714 ];
715715 }
716716 if ($ this ->typeProcessor ->isArrayType ($ type )) {
717717 // Array of complex type
718- $ arrayType = substr ($ type , 0 , -2 );
718+ $ arrayType = $ type !== null ? substr ($ type , 0 , -2 ) : '' ;
719719 return $ this ->handleComplex ($ name , $ arrayType , $ prefix , true );
720720 } else {
721721 // Complex type
@@ -739,9 +739,7 @@ private function handleComplex($name, $type, $prefix, $isArray)
739739 $ queryNames = [];
740740 foreach ($ parameters as $ subParameterName => $ subParameterInfo ) {
741741 $ subParameterType = $ subParameterInfo ['type ' ];
742- $ subParameterDescription = isset ($ subParameterInfo ['documentation ' ])
743- ? $ subParameterInfo ['documentation ' ]
744- : null ;
742+ $ subParameterDescription = $ subParameterInfo ['documentation ' ] ?? null ;
745743 $ subPrefix = $ prefix
746744 ? $ prefix . '[ ' . $ name . '] '
747745 : $ name ;
@@ -784,8 +782,8 @@ private function convertPathParams($uri)
784782 $ parts = explode ('/ ' , $ uri );
785783 $ count = count ($ parts );
786784 for ($ i =0 ; $ i < $ count ; $ i ++) {
787- if (strpos ($ parts [$ i ], ': ' ) === 0 ) {
788- $ parts [$ i ] = '{ ' . substr ($ parts [$ i ], 1 ) . '} ' ;
785+ if (strpos ($ parts [$ i ] ?? '' , ': ' ) === 0 ) {
786+ $ parts [$ i ] = '{ ' . substr ($ parts [$ i ] ?? '' , 1 ) . '} ' ;
789787 }
790788 }
791789 return implode ('/ ' , $ parts );
0 commit comments