@@ -62,6 +62,44 @@ private function transformCommonType(Type $type): Type
6262 }
6363
6464 return TypeTraverser::map ($ type , function (Type $ type , callable $ traverse ) {
65+ if ($ type instanceof CallableType) {
66+ if ($ type ->isCommonCallable ()) {
67+ return $ type ;
68+ }
69+
70+ return new CallableType (
71+ $ type ->getParameters (),
72+ $ traverse ($ this ->transformCommonType ($ type ->getReturnType ())),
73+ $ type ->isVariadic (),
74+ $ type ->getTemplateTypeMap (),
75+ $ type ->getResolvedTemplateTypeMap (),
76+ $ type ->getTemplateTags (),
77+ $ type ->isPure (),
78+ );
79+ }
80+
81+ if ($ type instanceof ClosureType) {
82+ if ($ type ->isCommonCallable ()) {
83+ return $ type ;
84+ }
85+
86+ return new ClosureType (
87+ $ type ->getParameters (),
88+ $ traverse ($ this ->transformCommonType ($ type ->getReturnType ())),
89+ $ type ->isVariadic (),
90+ $ type ->getTemplateTypeMap (),
91+ $ type ->getResolvedTemplateTypeMap (),
92+ $ type ->getCallSiteVarianceMap (),
93+ $ type ->getTemplateTags (),
94+ $ type ->getThrowPoints (),
95+ $ type ->getImpurePoints (),
96+ $ type ->getInvalidateExpressions (),
97+ $ type ->getUsedVariables (),
98+ $ type ->acceptsNamedArguments (),
99+ $ type ->mustUseReturnValue (),
100+ );
101+ }
102+
65103 if ($ type instanceof TemplateMixedType) {
66104 if ($ this ->checkExplicitMixed ) {
67105 return $ type ->toStrictMixedType ();
0 commit comments