@@ -200,6 +200,7 @@ function () use ($level): string {
200200
201201 private function describeItself (VerbosityLevel $ level , bool $ skipAccessoryTypes ): string
202202 {
203+ $ baseTypes = [];
203204 $ typesToDescribe = [];
204205 $ skipTypeNames = [];
205206
@@ -238,23 +239,39 @@ private function describeItself(VerbosityLevel $level, bool $skipAccessoryTypes)
238239 continue ;
239240 }
240241
241- if ($ skipAccessoryTypes ) {
242+ if ($ type instanceof CallableType && $ type ->isCommonCallable ()) {
243+ $ typesToDescribe [] = $ type ;
244+ $ skipTypeNames [] = 'object ' ;
245+ $ skipTypeNames [] = 'string ' ;
242246 continue ;
243247 }
244248
245249 if (!$ type instanceof AccessoryType) {
250+ $ baseTypes [] = $ type ;
251+ continue ;
252+ }
253+
254+ if ($ skipAccessoryTypes ) {
246255 continue ;
247256 }
248257
249258 $ typesToDescribe [] = $ type ;
250259 }
251260
252261 $ describedTypes = [];
253- foreach ($ this ->getSortedTypes () as $ type ) {
254- if ($ type instanceof AccessoryType) {
255- continue ;
256- }
262+ foreach ($ baseTypes as $ type ) {
257263 $ typeDescription = $ type ->describe ($ level );
264+
265+ if (in_array ($ typeDescription , ['object ' , 'string ' ], true ) && in_array ($ typeDescription , $ skipTypeNames , true )) {
266+ foreach ($ typesToDescribe as $ j => $ typeToDescribe ) {
267+ if ($ typeToDescribe instanceof CallableType && $ typeToDescribe ->isCommonCallable ()) {
268+ $ describedTypes [] = 'callable- ' . $ typeDescription ;
269+ unset($ typesToDescribe [$ j ]);
270+ continue 2 ;
271+ }
272+ }
273+ }
274+
258275 if (
259276 substr ($ typeDescription , 0 , strlen ('array< ' )) === 'array< '
260277 && in_array ('array ' , $ skipTypeNames , true )
0 commit comments