69
69
use Prophecy \Argument ;
70
70
use Prophecy \PhpUnit \ProphecyTrait ;
71
71
use Psr \Container \ContainerInterface ;
72
- use Symfony \Component \PropertyInfo \Type ;
73
72
use Symfony \Component \Serializer \NameConverter \CamelCaseToSnakeCaseNameConverter ;
73
+ use Symfony \Component \TypeInfo \Type ;
74
74
75
75
class OpenApiFactoryTest extends TestCase
76
76
{
@@ -303,7 +303,7 @@ public function testInvoke(): void
303
303
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
304
304
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'id ' , Argument::any ())->shouldBeCalled ()->willReturn (
305
305
(new ApiProperty ())
306
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] )
306
+ ->withNativeType ( Type:: int () )
307
307
->withDescription ('This is an id. ' )
308
308
->withReadable (true )
309
309
->withWritable (false )
@@ -312,7 +312,7 @@ public function testInvoke(): void
312
312
);
313
313
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'name ' , Argument::any ())->shouldBeCalled ()->willReturn (
314
314
(new ApiProperty ())
315
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
315
+ ->withNativeType ( Type:: string () )
316
316
->withDescription ('This is a name. ' )
317
317
->withReadable (true )
318
318
->withWritable (true )
@@ -324,7 +324,7 @@ public function testInvoke(): void
324
324
);
325
325
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'description ' , Argument::any ())->shouldBeCalled ()->willReturn (
326
326
(new ApiProperty ())
327
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
327
+ ->withNativeType ( Type:: string () )
328
328
->withDescription ('This is an initializable but not writable property. ' )
329
329
->withReadable (true )
330
330
->withWritable (false )
@@ -337,7 +337,7 @@ public function testInvoke(): void
337
337
);
338
338
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'dummyDate ' , Argument::any ())->shouldBeCalled ()->willReturn (
339
339
(new ApiProperty ())
340
- ->withBuiltinTypes ([ new Type (Type::BUILTIN_TYPE_OBJECT , true , \DateTime::class)] )
340
+ ->withNativeType ( Type:: nullable (Type::object ( \DateTime::class)) )
341
341
->withDescription ('This is a \DateTimeInterface object. ' )
342
342
->withReadable (true )
343
343
->withWritable (true )
@@ -349,7 +349,7 @@ public function testInvoke(): void
349
349
);
350
350
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'enum ' , Argument::any ())->shouldBeCalled ()->willReturn (
351
351
(new ApiProperty ())
352
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
352
+ ->withNativeType ( Type:: string () )
353
353
->withDescription ('This is an enum. ' )
354
354
->withReadable (true )
355
355
->withWritable (true )
@@ -362,7 +362,7 @@ public function testInvoke(): void
362
362
);
363
363
$ propertyMetadataFactoryProphecy ->create (OutputDto::class, 'id ' , Argument::any ())->shouldBeCalled ()->willReturn (
364
364
(new ApiProperty ())
365
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] )
365
+ ->withNativeType ( Type:: int () )
366
366
->withDescription ('This is an id. ' )
367
367
->withReadable (true )
368
368
->withWritable (false )
@@ -371,7 +371,7 @@ public function testInvoke(): void
371
371
);
372
372
$ propertyMetadataFactoryProphecy ->create (OutputDto::class, 'name ' , Argument::any ())->shouldBeCalled ()->willReturn (
373
373
(new ApiProperty ())
374
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
374
+ ->withNativeType ( Type:: string () )
375
375
->withDescription ('This is a name. ' )
376
376
->withReadable (true )
377
377
->withWritable (true )
@@ -383,7 +383,7 @@ public function testInvoke(): void
383
383
);
384
384
$ propertyMetadataFactoryProphecy ->create (OutputDto::class, 'description ' , Argument::any ())->shouldBeCalled ()->willReturn (
385
385
(new ApiProperty ())
386
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
386
+ ->withNativeType ( Type:: string () )
387
387
->withDescription ('This is an initializable but not writable property. ' )
388
388
->withReadable (true )
389
389
->withWritable (false )
@@ -394,7 +394,7 @@ public function testInvoke(): void
394
394
);
395
395
$ propertyMetadataFactoryProphecy ->create (OutputDto::class, 'dummyDate ' , Argument::any ())->shouldBeCalled ()->willReturn (
396
396
(new ApiProperty ())
397
- ->withBuiltinTypes ([ new Type (Type::BUILTIN_TYPE_OBJECT , true , \DateTime::class)] )
397
+ ->withNativeType ( Type:: nullable (Type::object ( \DateTime::class)) )
398
398
->withDescription ('This is a \DateTimeInterface object. ' )
399
399
->withReadable (true )
400
400
->withWritable (true )
@@ -404,7 +404,7 @@ public function testInvoke(): void
404
404
);
405
405
$ propertyMetadataFactoryProphecy ->create (OutputDto::class, 'enum ' , Argument::any ())->shouldBeCalled ()->willReturn (
406
406
(new ApiProperty ())
407
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
407
+ ->withNativeType ( Type:: string () )
408
408
->withDescription ('This is an enum. ' )
409
409
->withReadable (true )
410
410
->withWritable (true )
@@ -417,7 +417,7 @@ public function testInvoke(): void
417
417
foreach ([DummyErrorResource::class, Error::class] as $ cl ) {
418
418
$ propertyMetadataFactoryProphecy ->create ($ cl , 'type ' , Argument::any ())->shouldBeCalled ()->willReturn (
419
419
(new ApiProperty ())
420
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
420
+ ->withNativeType ( Type:: string () )
421
421
->withDescription ('This is an error type. ' )
422
422
->withReadable (true )
423
423
->withWritable (false )
@@ -428,7 +428,7 @@ public function testInvoke(): void
428
428
);
429
429
$ propertyMetadataFactoryProphecy ->create ($ cl , 'title ' , Argument::any ())->shouldBeCalled ()->willReturn (
430
430
(new ApiProperty ())
431
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
431
+ ->withNativeType ( Type:: string () )
432
432
->withDescription ('This is an error title. ' )
433
433
->withReadable (true )
434
434
->withWritable (false )
@@ -439,7 +439,7 @@ public function testInvoke(): void
439
439
);
440
440
$ propertyMetadataFactoryProphecy ->create ($ cl , 'status ' , Argument::any ())->shouldBeCalled ()->willReturn (
441
441
(new ApiProperty ())
442
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] )
442
+ ->withNativeType ( Type:: int () )
443
443
->withDescription ('This is an error status. ' )
444
444
->withReadable (true )
445
445
->withWritable (false )
@@ -448,7 +448,7 @@ public function testInvoke(): void
448
448
);
449
449
$ propertyMetadataFactoryProphecy ->create ($ cl , 'detail ' , Argument::any ())->shouldBeCalled ()->willReturn (
450
450
(new ApiProperty ())
451
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
451
+ ->withNativeType ( Type:: string () )
452
452
->withDescription ('This is an error detail. ' )
453
453
->withReadable (true )
454
454
->withWritable (false )
@@ -459,7 +459,7 @@ public function testInvoke(): void
459
459
);
460
460
$ propertyMetadataFactoryProphecy ->create ($ cl , 'instance ' , Argument::any ())->shouldBeCalled ()->willReturn (
461
461
(new ApiProperty ())
462
- ->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] )
462
+ ->withNativeType ( Type:: string () )
463
463
->withDescription ('This is an error instance. ' )
464
464
->withReadable (true )
465
465
->withWritable (false )
0 commit comments