@@ -100,7 +100,7 @@ public function testHasNothingToMapTo()
100
100
{
101
101
$ this ->expectException (MappingException::class);
102
102
$ this ->expectExceptionMessage ('Mapping target not found for source "class@anonymous". ' );
103
- (new ObjectMapper ())->map (new class () {});
103
+ (new ObjectMapper ())->map (new class {});
104
104
}
105
105
106
106
public function testHasNothingToMapToWithNamedClass ()
@@ -211,7 +211,7 @@ public function get(string $id): mixed
211
211
};
212
212
}
213
213
214
- public function testSourceOnly (): void
214
+ public function testSourceOnly ()
215
215
{
216
216
$ a = new \stdClass ();
217
217
$ a ->name = 'test ' ;
@@ -220,7 +220,7 @@ public function testSourceOnly(): void
220
220
$ this ->assertInstanceOf (SourceOnly::class, $ mapped );
221
221
$ this ->assertSame ('test ' , $ mapped ->mappedName );
222
222
223
- $ a = new class () {
223
+ $ a = new class {
224
224
public function __get (string $ key ): string
225
225
{
226
226
return match ($ key ) {
@@ -235,13 +235,12 @@ public function __get(string $key): string
235
235
$ this ->assertSame ('test ' , $ mapped ->mappedName );
236
236
}
237
237
238
-
239
- public function testTransformToWrongValueType (): void
238
+ public function testTransformToWrongValueType ()
240
239
{
241
240
$ this ->expectException (MappingTransformException::class);
242
241
$ this ->expectExceptionMessage ('Cannot map "stdClass" to a non-object target of type "string". ' );
243
242
244
- $ u = new \stdClass ;
243
+ $ u = new \stdClass () ;
245
244
$ u ->foo = 'bar ' ;
246
245
247
246
$ metadata = $ this ->createStub (ObjectMapperMetadataFactoryInterface::class);
@@ -250,16 +249,16 @@ public function testTransformToWrongValueType(): void
250
249
$ mapper ->map ($ u );
251
250
}
252
251
253
- public function testTransformToWrongObject (): void
252
+ public function testTransformToWrongObject ()
254
253
{
255
254
$ this ->expectException (MappingException::class);
256
- $ this ->expectExceptionMessage (sprintf ('Expected the mapped object to be an instance of "%s" but got "stdClass". ' , ClassWithoutTarget::class));
255
+ $ this ->expectExceptionMessage (\ sprintf ('Expected the mapped object to be an instance of "%s" but got "stdClass". ' , ClassWithoutTarget::class));
257
256
258
- $ u = new \stdClass ;
257
+ $ u = new \stdClass () ;
259
258
$ u ->foo = 'bar ' ;
260
259
261
260
$ metadata = $ this ->createStub (ObjectMapperMetadataFactoryInterface::class);
262
- $ metadata ->method ('create ' )->with ($ u )->willReturn ([new Mapping (target: ClassWithoutTarget::class, transform: fn () => new \stdClass )]);
261
+ $ metadata ->method ('create ' )->with ($ u )->willReturn ([new Mapping (target: ClassWithoutTarget::class, transform: fn () => new \stdClass () )]);
263
262
$ mapper = new ObjectMapper ($ metadata );
264
263
$ mapper ->map ($ u );
265
264
}
0 commit comments