@@ -94,6 +94,8 @@ private function getFieldsByAnnotations(string $annotationName): array
9494
9595 $ queryList = [];
9696
97+ $ typeResolver = new \phpDocumentor \Reflection \TypeResolver ();
98+
9799 foreach ($ refClass ->getMethods () as $ refMethod ) {
98100 $ standardPhpMethod = new \ReflectionMethod (get_class ($ this ->controller ), $ refMethod ->getName ());
99101 // First, let's check the "Query" annotation
@@ -108,7 +110,9 @@ private function getFieldsByAnnotations(string $annotationName): array
108110
109111 $ args = $ this ->mapParameters ($ refMethod , $ standardPhpMethod );
110112
111- $ type = $ this ->mapType ($ refMethod ->getReturnType ()->getTypeObject (), $ refMethod ->getDocBlockReturnTypes (), $ standardPhpMethod ->getReturnType ()->allowsNull ());
113+ $ phpdocType = $ typeResolver ->resolve ((string ) $ refMethod ->getReturnType ());
114+
115+ $ type = $ this ->mapType ($ phpdocType , $ refMethod ->getDocBlockReturnTypes (), $ standardPhpMethod ->getReturnType ()->allowsNull ());
112116
113117 $ queryList [] = new QueryField ($ methodName , $ type , $ args , [$ this ->controller , $ methodName ], $ this ->hydrator );
114118 }
@@ -151,10 +155,16 @@ private function isAuthorized(\ReflectionMethod $reflectionMethod) : bool
151155 private function mapParameters (ReflectionMethod $ refMethod , \ReflectionMethod $ standardRefMethod )
152156 {
153157 $ args = [];
158+
159+ $ typeResolver = new \phpDocumentor \Reflection \TypeResolver ();
160+
154161 foreach ($ standardRefMethod ->getParameters () as $ standardParameter ) {
155162 $ allowsNull = $ standardParameter ->allowsNull ();
156163 $ parameter = $ refMethod ->getParameter ($ standardParameter ->getName ());
157- $ args [$ parameter ->getName ()] = $ this ->mapType ($ parameter ->getTypeHint (), $ parameter ->getDocBlockTypes (), $ allowsNull );
164+
165+ $ phpdocType = $ typeResolver ->resolve ((string ) $ parameter ->getType ());
166+
167+ $ args [$ parameter ->getName ()] = $ this ->mapType ($ phpdocType , $ parameter ->getDocBlockTypes (), $ allowsNull );
158168 }
159169
160170 return $ args ;
0 commit comments