@@ -251,19 +251,29 @@ public function printParameters($function, PhpNamespace $namespace = null): stri
251251 {
252252 $ params = [];
253253 $ list = $ function ->getParameters ();
254+ $ special = false ;
255+
254256 foreach ($ list as $ param ) {
255257 $ variadic = $ function ->isVariadic () && $ param === end ($ list );
256258 $ type = $ param ->getType ();
257- $ params [] = ltrim ($ this ->printType ($ type , $ param ->isNullable (), $ namespace ) . ' ' )
259+ $ promoted = $ param instanceof PromotedParameter ? $ param : null ;
260+ $ params [] =
261+ ($ promoted ? Helpers::formatDocComment ((string ) $ promoted ->getComment ()) : '' )
262+ . ($ promoted ? ($ promoted ->getVisibility () ?: 'public ' ) . ' ' : '' )
263+ . ltrim ($ this ->printType ($ type , $ param ->isNullable (), $ namespace ) . ' ' )
258264 . ($ param ->isReference () ? '& ' : '' )
259265 . ($ variadic ? '... ' : '' )
260266 . '$ ' . $ param ->getName ()
261267 . ($ param ->hasDefaultValue () && !$ variadic ? ' = ' . $ this ->dump ($ param ->getDefaultValue ()) : '' );
268+
269+ $ special = $ special || $ promoted ;
262270 }
263271
264- return strlen ($ tmp = implode (', ' , $ params )) > (new Dumper )->wrapLength && count ($ params ) > 1
265- ? "( \n" . $ this ->indentation . implode (", \n" . $ this ->indentation , $ params ) . "\n) "
266- : "( $ tmp) " ;
272+ $ line = implode (', ' , $ params );
273+
274+ return count ($ params ) > 1 && ($ special || strlen ($ line ) > (new Dumper )->wrapLength )
275+ ? "( \n" . $ this ->indent (implode (", \n" , $ params )) . "\n) "
276+ : "( $ line) " ;
267277 }
268278
269279
0 commit comments