Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f803dc1

Browse filesBrowse files
committed
minor #60031 [ObjectMapper] CS fixes (OskarStark)
This PR was merged into the 7.3 branch. Discussion ---------- [ObjectMapper] CS fixes | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | -- | License | MIT Commits ------- e2d9c52 [ObjectMapper] CS fixes
2 parents 8531d2a + e2d9c52 commit f803dc1
Copy full SHA for f803dc1

File tree

2 files changed

+11
-16
lines changed
Filter options

2 files changed

+11
-16
lines changed

‎src/Symfony/Component/ObjectMapper/ObjectMapper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ObjectMapper/ObjectMapper.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@
2929
final class ObjectMapper implements ObjectMapperInterface
3030
{
3131
/**
32-
* A SplObjectStorage that tracks recursive references.
32+
* Tracks recursive references.
3333
*/
3434
private ?\SplObjectStorage $objectMap = null;
3535

36-
/**
37-
* @param ContainerInterface $transformCallableLocator
38-
* @param ContainerInterface $conditionCallableLocator
39-
*/
4036
public function __construct(
4137
private readonly ObjectMapperMetadataFactoryInterface $metadataFactory = new ReflectionObjectMapperMetadataFactory(),
4238
private readonly ?PropertyAccessorInterface $propertyAccessor = null,
@@ -77,7 +73,7 @@ public function map(object $source, object|string|null $target = null): object
7773
$mappedTarget = $this->applyTransforms($map, $mappedTarget, $mappedTarget);
7874

7975
if (!\is_object($mappedTarget)) {
80-
throw new MappingTransformException(sprintf('Cannot map "%s" to a non-object target of type "%s".', get_debug_type($source), get_debug_type($mappedTarget)));
76+
throw new MappingTransformException(\sprintf('Cannot map "%s" to a non-object target of type "%s".', get_debug_type($source), get_debug_type($mappedTarget)));
8177
}
8278
}
8379

‎src/Symfony/Component/ObjectMapper/Tests/ObjectMapperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ObjectMapper/Tests/ObjectMapperTest.php
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testHasNothingToMapTo()
100100
{
101101
$this->expectException(MappingException::class);
102102
$this->expectExceptionMessage('Mapping target not found for source "class@anonymous".');
103-
(new ObjectMapper())->map(new class () {});
103+
(new ObjectMapper())->map(new class {});
104104
}
105105

106106
public function testHasNothingToMapToWithNamedClass()
@@ -211,7 +211,7 @@ public function get(string $id): mixed
211211
};
212212
}
213213

214-
public function testSourceOnly(): void
214+
public function testSourceOnly()
215215
{
216216
$a = new \stdClass();
217217
$a->name = 'test';
@@ -220,7 +220,7 @@ public function testSourceOnly(): void
220220
$this->assertInstanceOf(SourceOnly::class, $mapped);
221221
$this->assertSame('test', $mapped->mappedName);
222222

223-
$a = new class () {
223+
$a = new class {
224224
public function __get(string $key): string
225225
{
226226
return match ($key) {
@@ -235,13 +235,12 @@ public function __get(string $key): string
235235
$this->assertSame('test', $mapped->mappedName);
236236
}
237237

238-
239-
public function testTransformToWrongValueType(): void
238+
public function testTransformToWrongValueType()
240239
{
241240
$this->expectException(MappingTransformException::class);
242241
$this->expectExceptionMessage('Cannot map "stdClass" to a non-object target of type "string".');
243242

244-
$u = new \stdClass;
243+
$u = new \stdClass();
245244
$u->foo = 'bar';
246245

247246
$metadata = $this->createStub(ObjectMapperMetadataFactoryInterface::class);
@@ -250,16 +249,16 @@ public function testTransformToWrongValueType(): void
250249
$mapper->map($u);
251250
}
252251

253-
public function testTransformToWrongObject(): void
252+
public function testTransformToWrongObject()
254253
{
255254
$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));
257256

258-
$u = new \stdClass;
257+
$u = new \stdClass();
259258
$u->foo = 'bar';
260259

261260
$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())]);
263262
$mapper = new ObjectMapper($metadata);
264263
$mapper->map($u);
265264
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.