@@ -356,9 +356,11 @@ protected function formatFunctionSignature(BmmFunction $function, string $prefix
356356 }
357357 $ args = implode (", + \n" , array_map (function ($ parameter ) use ($ prefix , $ schema ) {
358358 if ($ parameter instanceof BmmContainerFunctionParameter) {
359- return $ parameter ->name . ': ` ' . $ this ->formatContainerType ($ parameter ->typeDef , $ prefix , $ schema ) . ($ parameter ->isNullable ? '' : '[1] ' ) . '` ' ;
359+ $ type = $ this ->formatContainerType ($ parameter ->typeDef , $ prefix , $ schema );
360+ return $ parameter ->name . ': ` ' . $ type . ($ parameter ->isNullable ? '' : '[1] ' ) . '` ' ;
360361 } elseif ($ parameter instanceof BmmGenericFunctionParameter) {
361- return $ parameter ->name . ': ` ' . $ this ->formatGenericType ($ parameter ->typeDef , $ prefix , $ schema ) . ($ parameter ->isNullable ? '' : '[1] ' ) . '` ' ;
362+ $ type = $ this ->formatGenericType ($ parameter ->typeDef , $ prefix , $ schema );
363+ return $ parameter ->name . ': ` ' . $ type . ($ parameter ->isNullable ? '' : '[1] ' ) . '` ' ;
362364 } elseif ($ parameter instanceof BmmSingleFunctionParameter || $ parameter instanceof BmmSingleFunctionParameterOpen) {
363365 return $ parameter ->name . ': ` ' . $ this ->formatType ($ parameter ->type , $ prefix , $ schema ) . ($ parameter ->isNullable ? '' : '[1] ' ) . '` ' ;
364366 }
@@ -404,14 +406,16 @@ protected function formatContainerType(BmmContainerType $type, string $prefix, B
404406 protected function formatGenericType (BmmGenericType $ type , string $ prefix , BmmSchema $ schema ): string
405407 {
406408 if (!empty ($ type ->genericParameters )) {
409+ /** @var array<string|BmmGenericType> $params — library types string[] but nested generics produce BmmGenericType */
410+ $ params = $ type ->genericParameters ;
407411 $ genericParameters = implode (', ' , array_map (
408412 function (string |BmmGenericType $ t ) use ($ prefix , $ schema ): string {
409413 if ($ t instanceof BmmGenericType) {
410414 return $ this ->formatGenericType ($ t , $ prefix , $ schema );
411415 }
412416 return $ this ->formatType ($ t , $ prefix , $ schema );
413417 },
414- $ type -> genericParameters ,
418+ $ params ,
415419 ));
416420 } elseif (!empty ($ type ->genericParameterDefs )) {
417421 $ genericParameters = implode (', ' , array_map (function ($ t ) use ($ prefix , $ schema ) {
@@ -471,15 +475,19 @@ public function formatType(string $type, string $prefix, BmmSchema $schema): str
471475 // type is on the same spec page, an example format is '<<_boolean_class,Boolean>>'
472476 return '<<_ ' . strtolower ($ type ) . '_ ' . $ classType . ', ' . $ type . '>> ' ;
473477 }
474- // an example format is 'link:/releases/BASE/{base_release}/foundation_types.html#_boolean_class[Boolean^]'
475- return 'link:/releases/ ' . $ m [0 ] . '/{ ' . strtolower ($ m [0 ]) . '_release}/ ' . $ m [1 ] . '.html#_ ' . strtolower ($ type ) . '_ ' . $ classType . '[ ' . $ type . '^] ' ;
478+ // format: 'link:/releases/BASE/{base_release}/foundation_types.html#_boolean_class[Boolean^]'
479+ $ rel = strtolower ($ m [0 ]) . '_release ' ;
480+ $ anchor = strtolower ($ type ) . '_ ' . $ classType ;
481+ return "link:/releases/ {$ m [0 ]}/{ {$ rel }}/ {$ m [1 ]}.html#_ {$ anchor }[ {$ type }^] " ;
476482 }
477483
478- // an example format is 'xref:/releases/ BASE/{base_release}/ foundation_types.html #_boolean_class[Boolean^ ]'
484+ // format: 'xref:BASE: foundation_types:overview.adoc #_boolean_class[Boolean]'
479485 $ xref = match ($ xref ) {
480486 'BASE:foundation_types ' => 'BASE:foundation_types:overview ' ,
481487 'BASE:foundation_types:time ' => 'BASE:foundation_types:time_types ' ,
482- 'BASE:foundation_types:structures ' , 'BASE:foundation_types:structure ' , 'BASE:foundation_types:structure_package ' => 'BASE:foundation_types:structure_types ' ,
488+ 'BASE:foundation_types:structures ' ,
489+ 'BASE:foundation_types:structure ' ,
490+ 'BASE:foundation_types:structure_package ' => 'BASE:foundation_types:structure_types ' ,
483491 'BASE:foundation_types:interval ' => 'BASE:foundation_types:interval ' ,
484492 'BASE:foundation_types:primitive_types ' => 'BASE:foundation_types:primitive_types ' ,
485493 'BASE:foundation_types:functional ' => 'BASE:foundation_types:functional ' ,
0 commit comments