@@ -41,7 +41,7 @@ public function testGetType(array $schema, Type $type): void
41
41
$ this ->assertEquals ($ schema , $ typeFactory ->getType ($ type , 'json ' , null , null , new Schema (Schema::VERSION_OPENAPI )));
42
42
}
43
43
44
- public function typeProvider (): iterable
44
+ public static function typeProvider (): iterable
45
45
{
46
46
yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT )];
47
47
yield [['nullable ' => true , 'type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT , true )];
@@ -169,7 +169,7 @@ public function testGetTypeWithJsonSchemaSyntax(array $schema, Type $type): void
169
169
$ this ->assertEquals ($ schema , $ typeFactory ->getType ($ type , 'json ' , null , null , new Schema (Schema::VERSION_JSON_SCHEMA )));
170
170
}
171
171
172
- public function jsonSchemaTypeProvider (): iterable
172
+ public static function jsonSchemaTypeProvider (): iterable
173
173
{
174
174
yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT )];
175
175
yield [['type ' => ['integer ' , 'null ' ]], new Type (Type::BUILTIN_TYPE_INT , true )];
@@ -290,7 +290,7 @@ public function testGetTypeWithOpenAPIV2Syntax(array $schema, Type $type): void
290
290
$ this ->assertEquals ($ schema , $ typeFactory ->getType ($ type , 'json ' , null , null , new Schema (Schema::VERSION_SWAGGER )));
291
291
}
292
292
293
- public function openAPIV2TypeProvider (): iterable
293
+ public static function openAPIV2TypeProvider (): iterable
294
294
{
295
295
yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT )];
296
296
yield [['type ' => 'integer ' ], new Type (Type::BUILTIN_TYPE_INT , true )];
@@ -412,20 +412,21 @@ public function testGetClassType(): void
412
412
}
413
413
414
414
/** @dataProvider classTypeWithNullabilityDataProvider */
415
- public function testGetClassTypeWithNullability (array $ expected , SchemaFactoryInterface $ schemaFactory , Schema $ schema ): void
415
+ public function testGetClassTypeWithNullability (array $ expected , callable $ schemaFactoryFactory , Schema $ schema ): void
416
416
{
417
417
$ typeFactory = new TypeFactory ();
418
- $ typeFactory ->setSchemaFactory ($ schemaFactory );
418
+ $ typeFactory ->setSchemaFactory ($ schemaFactoryFactory ( $ this ) );
419
419
420
420
self ::assertEquals (
421
421
$ expected ,
422
422
$ typeFactory ->getType (new Type (Type::BUILTIN_TYPE_OBJECT , true , Dummy::class), 'jsonld ' , true , ['foo ' => 'bar ' ], $ schema )
423
423
);
424
424
}
425
425
426
- public function classTypeWithNullabilityDataProvider (): iterable
426
+ public static function classTypeWithNullabilityDataProvider (): iterable
427
427
{
428
- $ schemaFactory = $ this ->createSchemaFactoryMock ($ schema = new Schema ());
428
+ $ schema = new Schema ();
429
+ $ schemaFactoryFactory = fn (self $ that ): SchemaFactoryInterface => $ that ->createSchemaFactoryMock ($ schema );
429
430
430
431
yield 'JSON-Schema version ' => [
431
432
[
@@ -434,11 +435,12 @@ public function classTypeWithNullabilityDataProvider(): iterable
434
435
['type ' => 'null ' ],
435
436
],
436
437
],
437
- $ schemaFactory ,
438
+ $ schemaFactoryFactory ,
438
439
$ schema ,
439
440
];
440
441
441
- $ schemaFactory = $ this ->createSchemaFactoryMock ($ schema = new Schema (Schema::VERSION_OPENAPI ));
442
+ $ schema = new Schema (Schema::VERSION_OPENAPI );
443
+ $ schemaFactoryFactory = fn (self $ that ): SchemaFactoryInterface => $ that ->createSchemaFactoryMock ($ schema );
442
444
443
445
yield 'OpenAPI < 3.1 version ' => [
444
446
[
@@ -447,7 +449,7 @@ public function classTypeWithNullabilityDataProvider(): iterable
447
449
],
448
450
'nullable ' => true ,
449
451
],
450
- $ schemaFactory ,
452
+ $ schemaFactoryFactory ,
451
453
$ schema ,
452
454
];
453
455
}
0 commit comments