@@ -71,7 +71,7 @@ public function build(\Reflector $reflector, Context $context): array
7171 foreach ($ rp ->getAttributes ($ attributeName , \ReflectionAttribute::IS_INSTANCEOF ) as $ attribute ) {
7272 /** @var OA\Property|OA\Parameter|OA\RequestBody $instance */
7373 $ instance = $ attribute ->newInstance ();
74- $ instance ->_context = new Context (['nested ' => false ], $ context );
74+ $ instance ->_context = new Context (['nested ' => false , ' reflector ' => $ rp ], $ context );
7575
7676 $ type = (($ rnt = $ rp ->getType ()) && $ rnt instanceof \ReflectionNamedType) ? $ rnt ->getName () : Generator::UNDEFINED ;
7777 $ nullable = $ rnt ? $ rnt ->allowsNull () : true ;
@@ -89,7 +89,7 @@ public function build(\Reflector $reflector, Context $context): array
8989
9090 if ($ rp ->isPromoted ()) {
9191 // ensure each property has its own context
92- $ instance ->_context = new Context (['generated ' => true , 'annotations ' => [$ instance ]], $ context );
92+ $ instance ->_context = new Context (['generated ' => true , 'annotations ' => [$ instance ], ' reflector ' => $ rp ], $ context );
9393
9494 // promoted parameter - docblock is available via class/property
9595 if ($ comment = $ rp ->getDeclaringClass ()->getProperty ($ rp ->getName ())->getDocComment ()) {
@@ -101,7 +101,7 @@ public function build(\Reflector $reflector, Context $context): array
101101 $ instance ->name = $ rp ->getName ();
102102 }
103103 $ instance ->required = !$ nullable ;
104- $ context = new Context (['nested ' => $ this ], $ context );
104+ $ context = new Context (['nested ' => $ this , ' reflector ' => $ rp ], $ context );
105105 $ context ->comment = null ;
106106 $ instance ->merge ([new OA \Schema (['type ' => $ type , '_context ' => $ context ])]);
107107 }
@@ -115,6 +115,7 @@ public function build(\Reflector $reflector, Context $context): array
115115 if ($ annotation instanceof OA \Property && Generator::isDefault ($ annotation ->type )) {
116116 // pick up simple return types
117117 $ annotation ->type = $ rrt ->getName ();
118+ $ annotation ->_context ->reflector = $ rrt ;
118119 }
119120 }
120121 }
0 commit comments