@@ -38,13 +38,11 @@ public function testParameterFactory(): void
3838 $ nameCollection = $ this ->createStub (PropertyNameCollectionFactoryInterface::class);
3939 $ nameCollection ->method ('create ' )->willReturn (new PropertyNameCollection (['id ' , 'hydra ' , 'everywhere ' ]));
4040 $ propertyMetadata = $ this ->createStub (PropertyMetadataFactoryInterface::class);
41- $ propertyMetadata ->method ('create ' )->willReturnOnConsecutiveCalls (
42- new ApiProperty (identifier: true ),
43- new ApiProperty (readable: true ),
44- new ApiProperty (readable: true ),
45- new ApiProperty (identifier: true ),
46- new ApiProperty (readable: true ),
47- new ApiProperty (readable: true )
41+ $ propertyMetadata ->method ('create ' )->willReturnCallback (
42+ static fn (string $ class , string $ property ) => match ($ property ) {
43+ 'id ' => new ApiProperty (identifier: true ),
44+ default => new ApiProperty (readable: true ),
45+ }
4846 );
4947 $ filterLocator = $ this ->createStub (ContainerInterface::class);
5048 $ filterLocator ->method ('has ' )->willReturn (true );
@@ -185,13 +183,11 @@ public function testParameterFactoryNoFilter(): void
185183 $ nameCollection = $ this ->createStub (PropertyNameCollectionFactoryInterface::class);
186184 $ nameCollection ->method ('create ' )->willReturn (new PropertyNameCollection (['id ' , 'hydra ' , 'everywhere ' ]));
187185 $ propertyMetadata = $ this ->createStub (PropertyMetadataFactoryInterface::class);
188- $ propertyMetadata ->method ('create ' )->willReturnOnConsecutiveCalls (
189- new ApiProperty (identifier: true ),
190- new ApiProperty (readable: true ),
191- new ApiProperty (readable: true ),
192- new ApiProperty (identifier: true ),
193- new ApiProperty (readable: true ),
194- new ApiProperty (readable: true )
186+ $ propertyMetadata ->method ('create ' )->willReturnCallback (
187+ static fn (string $ class , string $ property ) => match ($ property ) {
188+ 'id ' => new ApiProperty (identifier: true ),
189+ default => new ApiProperty (readable: true ),
190+ }
195191 );
196192 $ filterLocator = $ this ->createStub (ContainerInterface::class);
197193 $ filterLocator ->method ('has ' )->willReturn (false );
0 commit comments