2727use Prophecy \Argument ;
2828use Prophecy \PhpUnit \ProphecyTrait ;
2929use Symfony \Component \PropertyAccess \PropertyAccessorInterface ;
30- use Symfony \Component \PropertyInfo \Type ;
3130use Symfony \Component \Serializer \NameConverter \NameConverterInterface ;
31+ use Symfony \Component \TypeInfo \Type ;
3232
3333class MatchFilterTest extends TestCase
3434{
@@ -55,8 +55,8 @@ public function testApply(): void
5555 $ propertyNameCollectionFactoryProphecy ->create (Foo::class)->willReturn (new PropertyNameCollection (['id ' , 'name ' , 'bar ' ]))->shouldBeCalled ();
5656
5757 $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
58- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] ))->shouldBeCalled ();
59- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] ))->shouldBeCalled ();
58+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: int () ))->shouldBeCalled ();
59+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: string () ))->shouldBeCalled ();
6060
6161 $ foo = new Foo ();
6262 $ foo ->setName ('Xavier ' );
@@ -89,12 +89,12 @@ public function testApply(): void
8989
9090 public function testApplyWithNestedArrayProperty (): void
9191 {
92- $ fooType = new Type (Type:: BUILTIN_TYPE_ARRAY , false , Foo::class, true , new Type (Type::BUILTIN_TYPE_INT ), new Type (Type:: BUILTIN_TYPE_OBJECT , false , Foo::class));
93- $ barType = new Type (Type:: BUILTIN_TYPE_STRING );
92+ $ fooType = Type:: list (Type::object ( Foo::class));
93+ $ barType = Type:: string ( );
9494
9595 $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
96- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ fooType] ))->shouldBeCalled ();
97- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ barType] ))->shouldBeCalled ();
96+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withNativeType ( $ fooType ))->shouldBeCalled ();
97+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withNativeType ( $ barType ))->shouldBeCalled ();
9898
9999 $ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
100100 $ resourceClassResolverProphecy ->isResourceClass (Foo::class)->willReturn (true )->shouldBeCalled ();
@@ -121,12 +121,12 @@ public function testApplyWithNestedArrayProperty(): void
121121
122122 public function testApplyWithNestedObjectProperty (): void
123123 {
124- $ fooType = new Type (Type:: BUILTIN_TYPE_OBJECT , false , Foo::class);
125- $ barType = new Type (Type:: BUILTIN_TYPE_STRING );
124+ $ fooType = Type:: object ( Foo::class);
125+ $ barType = Type:: string ( );
126126
127127 $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
128- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ fooType] ))->shouldBeCalled ();
129- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ $ barType] ))->shouldBeCalled ();
128+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'foo ' )->willReturn ((new ApiProperty ())->withNativeType ( $ fooType ))->shouldBeCalled ();
129+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn ((new ApiProperty ())->withNativeType ( $ barType ))->shouldBeCalled ();
130130
131131 $ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
132132 $ resourceClassResolverProphecy ->isResourceClass (Foo::class)->willReturn (true )->shouldBeCalled ();
@@ -156,7 +156,7 @@ public function testApplyWithInvalidFilters(): void
156156 $ propertyNameCollectionFactoryProphecy ->create (Foo::class)->willReturn (new PropertyNameCollection (['id ' , 'bar ' ]))->shouldBeCalled ();
157157
158158 $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
159- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] ))->shouldBeCalled ();
159+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: int () ))->shouldBeCalled ();
160160 $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn (new ApiProperty ())->shouldBeCalled ();
161161
162162 $ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
@@ -183,11 +183,11 @@ public function testGetDescription(): void
183183 $ propertyNameCollectionFactoryProphecy ->create (Foo::class)->willReturn (new PropertyNameCollection (['id ' , 'name ' , 'bar ' , 'date ' , 'weird ' ]))->shouldBeCalled ();
184184
185185 $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
186- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_INT )] ))->shouldBeCalled ();
187- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_STRING )] ))->shouldBeCalled ();
186+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'id ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: int () ))->shouldBeCalled ();
187+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'name ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: string () ))->shouldBeCalled ();
188188 $ propertyMetadataFactoryProphecy ->create (Foo::class, 'bar ' )->willReturn (new ApiProperty ())->shouldBeCalled ();
189- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'date ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_OBJECT , false , \DateTimeImmutable::class)] ))->shouldBeCalled ();
190- $ propertyMetadataFactoryProphecy ->create (Foo::class, 'weird ' )->willReturn ((new ApiProperty ())->withBuiltinTypes ([ new Type (Type:: BUILTIN_TYPE_RESOURCE )] ))->shouldBeCalled ();
189+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'date ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: object ( \DateTimeImmutable::class)))->shouldBeCalled ();
190+ $ propertyMetadataFactoryProphecy ->create (Foo::class, 'weird ' )->willReturn ((new ApiProperty ())->withNativeType ( Type:: resource () ))->shouldBeCalled ();
191191
192192 $ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
193193 $ resourceClassResolverProphecy ->isResourceClass (\DateTimeImmutable::class)->willReturn (false )->shouldBeCalled ();
0 commit comments