@@ -169,7 +169,8 @@ private static function fillUpSchema(string $name, string $namespace, string $cl
169
169
170
170
171
171
$ propertyStmt ->setType (($ propertyType === 'array ' ? '' : $ nullable ) . $ propertyType );
172
- $ constructor ->addParam ((new Param ($ propertyName ))->setType ($ propertyType ))->addStmt (
172
+ $ constructorParam = (new Param ($ propertyName ))->setType ($ propertyType );
173
+ $ constructor ->addStmt (
173
174
new Node \Expr \Assign (
174
175
new Node \Expr \PropertyFetch (
175
176
new Node \Expr \Variable ('this ' ),
@@ -184,17 +185,20 @@ private static function fillUpSchema(string $name, string $namespace, string $cl
184
185
if (is_array ($ property ->anyOf ) && $ property ->anyOf [0 ] instanceof OpenAPiSchema/* && array_key_exists(spl_object_hash($property->anyOf[0]), $schemaClassNameMap)*/ ) {
185
186
$ fqcnn = '\\' . $ rootNamespace . '\\' . $ schemaRegistry ->get ($ property ->anyOf [0 ], $ className . '\\' . (new Convert ($ propertyName ))->toPascal ());
186
187
$ propertyStmt ->setType ($ nullable . $ fqcnn );
188
+ $ constructorParam ->setType ($ nullable . $ fqcnn );
187
189
$ setDefaylt = false ;
188
190
} else if (is_array ($ property ->allOf ) && $ property ->allOf [0 ] instanceof OpenAPiSchema/* && array_key_exists(spl_object_hash($property->allOf[0]), $schemaClassNameMap)*/ ) {
189
191
$ fqcnn = '\\' . $ rootNamespace . '\\' . $ schemaRegistry ->get ($ property ->allOf [0 ], $ className . '\\' . (new Convert ($ propertyName ))->toPascal ());
190
192
$ propertyStmt ->setType ($ nullable . $ fqcnn );
193
+ $ constructorParam ->setType ($ nullable . $ fqcnn );
191
194
$ setDefaylt = false ;
192
195
}
193
196
194
197
// if (($property->type === 'object' || (is_array($property->type) && count($property->type) === 2)) && $property instanceof OpenAPiSchema/* && array_key_exists(spl_object_hash($property), $schemaClassNameMap)*/) {
195
198
if ($ propertyType === 'object ' ) {
196
199
$ fqcnn = '\\' . $ rootNamespace . '\\' . $ schemaRegistry ->get ($ property , $ className . '\\' . (new Convert ($ propertyName ))->toPascal ());
197
200
$ propertyStmt ->setType ($ nullable . $ fqcnn );
201
+ $ constructorParam ->setType ($ nullable . $ fqcnn );
198
202
$ setDefaylt = false ;
199
203
}
200
204
@@ -222,6 +226,7 @@ private static function fillUpSchema(string $name, string $namespace, string $cl
222
226
}
223
227
224
228
$ class ->addStmt ($ propertyStmt );
229
+ $ constructor ->addParam ($ constructorParam );
225
230
}
226
231
227
232
if (count ($ constructDocBlock ) > 0 ) {
0 commit comments