@@ -117,30 +117,30 @@ public static function generate(string $name, string $namespace, string $classNa
117
117
], $ property ->type );
118
118
119
119
if ($ t !== '' ) {
120
- $ propertyStmt ->setType ($ nullable . $ t );
121
- $ method ->setReturnType ($ nullable . $ t );
120
+ $ propertyStmt ->setType (( $ t === ' array ' ? '' : $ nullable) . $ t );
121
+ $ method ->setReturnType (( $ t === ' array ' ? '' : $ nullable) . $ t );
122
122
}
123
123
}
124
124
}
125
125
126
126
if (is_array ($ property ->anyOf ) && $ property ->anyOf [0 ] instanceof OpenAPiSchema && array_key_exists (spl_object_hash ($ property ->anyOf [0 ]), $ schemaClassNameMap )) {
127
- $ fqcnn = $ nullable . '\\' . $ rootNamespace . '\\' . $ schemaClassNameMap [spl_object_hash ($ property ->anyOf [0 ])];
128
- $ propertyStmt ->setType ($ fqcnn );
129
- $ method ->setReturnType ($ fqcnn );
127
+ $ fqcnn = '\\' . $ rootNamespace . '\\' . $ schemaClassNameMap [spl_object_hash ($ property ->anyOf [0 ])];
128
+ $ propertyStmt ->setType ($ nullable . $ fqcnn );
129
+ $ method ->setReturnType ($ nullable . $ fqcnn );
130
130
$ propertyDocBlock [] = '@\WyriHaximus\Hydrator\Attribute\Hydrate( ' . $ fqcnn . '::class) ' ;
131
131
$ setDefaylt = false ;
132
132
} else if (is_array ($ property ->allOf ) && $ property ->allOf [0 ] instanceof OpenAPiSchema && array_key_exists (spl_object_hash ($ property ->allOf [0 ]), $ schemaClassNameMap )) {
133
- $ fqcnn = $ nullable . '\\' . $ rootNamespace . '\\' . $ schemaClassNameMap [spl_object_hash ($ property ->allOf [0 ])];
134
- $ propertyStmt ->setType ($ fqcnn );
135
- $ method ->setReturnType ($ fqcnn );
133
+ $ fqcnn = '\\' . $ rootNamespace . '\\' . $ schemaClassNameMap [spl_object_hash ($ property ->allOf [0 ])];
134
+ $ propertyStmt ->setType ($ nullable . $ fqcnn );
135
+ $ method ->setReturnType ($ nullable . $ fqcnn );
136
136
$ propertyDocBlock [] = '@\WyriHaximus\Hydrator\Attribute\Hydrate( ' . $ fqcnn . '::class) ' ;
137
137
$ setDefaylt = false ;
138
138
}
139
139
140
140
if ($ property ->type === 'object ' && $ property instanceof OpenAPiSchema && array_key_exists (spl_object_hash ($ property ), $ schemaClassNameMap )) {
141
- $ fqcnn = $ nullable . '\\' . $ rootNamespace . '\\' . $ schemaClassNameMap [spl_object_hash ($ property )];
142
- $ propertyStmt ->setType ($ fqcnn );
143
- $ method ->setReturnType ($ fqcnn );
141
+ $ fqcnn = '\\' . $ rootNamespace . '\\' . $ schemaClassNameMap [spl_object_hash ($ property )];
142
+ $ propertyStmt ->setType ($ nullable . $ fqcnn );
143
+ $ method ->setReturnType ($ nullable . $ fqcnn );
144
144
$ propertyDocBlock [] = '@\WyriHaximus\Hydrator\Attribute\Hydrate( ' . $ fqcnn . '::class) ' ;
145
145
$ setDefaylt = false ;
146
146
}
0 commit comments