@@ -152,31 +152,31 @@ public function testGetTypeWithOpenAPIV2Syntax(array $schema, Type $type): void
152
152
153
153
public function openAPIV2typeProvider (): iterable
154
154
{
155
- yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT )];
156
- yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT , true )];
155
+ yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT , false )];
156
+ yield [['type ' => [ 'integer ' , ' null ' ] ], new Type (Type::BUILTIN_TYPE_INT , true )];
157
157
yield [['type ' => 'number ' ], new Type (Type::BUILTIN_TYPE_FLOAT )];
158
- yield [['type ' => 'number ' ], new Type (Type::BUILTIN_TYPE_FLOAT , true )];
158
+ yield [['type ' => [ 'number ' , ' null ' ] ], new Type (Type::BUILTIN_TYPE_FLOAT , true )];
159
159
yield [['type ' => 'boolean ' ], new Type (Type::BUILTIN_TYPE_BOOL )];
160
- yield [['type ' => 'boolean ' ], new Type (Type::BUILTIN_TYPE_BOOL , true )];
160
+ yield [['type ' => [ 'boolean ' , ' null ' ] ], new Type (Type::BUILTIN_TYPE_BOOL , true )];
161
161
yield [['type ' => 'string ' ], new Type (Type::BUILTIN_TYPE_STRING )];
162
- yield [['type ' => 'string ' ], new Type (Type::BUILTIN_TYPE_STRING , true )];
162
+ yield [['type ' => [ 'string ' , ' null ' ] ], new Type (Type::BUILTIN_TYPE_STRING , true )];
163
163
yield [['type ' => 'string ' ], new Type (Type::BUILTIN_TYPE_OBJECT )];
164
- yield [['type ' => 'string ' ], new Type (Type::BUILTIN_TYPE_OBJECT , true )];
164
+ yield [['type ' => [ 'string ' , ' null ' ] ], new Type (Type::BUILTIN_TYPE_OBJECT , true )];
165
165
yield [['type ' => 'string ' , 'format ' => 'date-time ' ], new Type (Type::BUILTIN_TYPE_OBJECT , false , \DateTimeImmutable::class)];
166
- yield [['type ' => 'string ' , 'format ' => 'date-time ' ], new Type (Type::BUILTIN_TYPE_OBJECT , true , \DateTimeImmutable::class)];
166
+ yield [['type ' => [ 'string ' , ' null ' ] , 'format ' => 'date-time ' ], new Type (Type::BUILTIN_TYPE_OBJECT , true , \DateTimeImmutable::class)];
167
167
yield [['type ' => 'string ' , 'format ' => 'duration ' ], new Type (Type::BUILTIN_TYPE_OBJECT , false , \DateInterval::class)];
168
168
yield [['type ' => 'string ' , 'format ' => 'iri-reference ' ], new Type (Type::BUILTIN_TYPE_OBJECT , false , Dummy::class)];
169
- yield [['type ' => 'string ' , 'format ' => 'iri-reference ' ], new Type (Type::BUILTIN_TYPE_OBJECT , true , Dummy::class)];
169
+ yield [['type ' => [ 'string ' , ' null ' ] , 'format ' => 'iri-reference ' ], new Type (Type::BUILTIN_TYPE_OBJECT , true , Dummy::class)];
170
170
yield [['type ' => 'array ' , 'items ' => ['type ' => 'string ' ]], new Type (Type::BUILTIN_TYPE_STRING , false , null , true )];
171
- yield 'array can be itself nullable, but ignored in OpenAPI V2 ' => [
172
- ['type ' => 'array ' , 'items ' => ['type ' => 'string ' ]],
171
+ yield 'array can be itself nullable ' => [
172
+ ['type ' => [ 'array ' , ' null ' ] , 'items ' => ['type ' => 'string ' ]],
173
173
new Type (Type::BUILTIN_TYPE_STRING , true , null , true ),
174
174
];
175
175
176
- yield 'array can contain nullable values, but ignored in OpenAPI V2 ' => [
176
+ yield 'array can contain nullable values ' => [
177
177
[
178
178
'type ' => 'array ' ,
179
- 'items ' => ['type ' => 'string ' ],
179
+ 'items ' => ['type ' => [ 'string ' , ' null ' ] ],
180
180
],
181
181
new Type (Type::BUILTIN_TYPE_STRING , false , null , true , null , new Type (Type::BUILTIN_TYPE_STRING , true , null , false )),
182
182
];
@@ -192,9 +192,9 @@ public function openAPIV2typeProvider(): iterable
192
192
),
193
193
];
194
194
195
- yield 'nullable map with string keys becomes a nullable object, but ignored in OpenAPI V2 ' => [
195
+ yield 'nullable map with string keys becomes a nullable object ' => [
196
196
[
197
- 'type ' => 'object ' ,
197
+ 'type ' => [ 'object ' , ' null ' ] ,
198
198
'additionalProperties ' => ['type ' => 'string ' ],
199
199
],
200
200
new Type (
@@ -219,10 +219,10 @@ public function openAPIV2typeProvider(): iterable
219
219
),
220
220
];
221
221
222
- yield 'map value type nullability will be considered, but ignored in OpenAPI V2 ' => [
222
+ yield 'map value type nullability will be considered ' => [
223
223
[
224
224
'type ' => 'object ' ,
225
- 'additionalProperties ' => ['type ' => 'integer ' ],
225
+ 'additionalProperties ' => ['type ' => [ 'integer ' , ' null ' ] ],
226
226
],
227
227
new Type (
228
228
Type::BUILTIN_TYPE_ARRAY ,
@@ -234,10 +234,10 @@ public function openAPIV2typeProvider(): iterable
234
234
),
235
235
];
236
236
237
- yield 'nullable map can contain nullable values, but ignored in OpenAPI V2 ' => [
237
+ yield 'nullable map can contain nullable values ' => [
238
238
[
239
- 'type ' => 'object ' ,
240
- 'additionalProperties ' => ['type ' => 'integer ' ],
239
+ 'type ' => [ 'object ' , ' null ' ] ,
240
+ 'additionalProperties ' => ['type ' => [ 'integer ' , ' null ' ] ],
241
241
],
242
242
new Type (
243
243
Type::BUILTIN_TYPE_ARRAY ,
0 commit comments