Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commitf803dc1

Browse 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 | MITCommits-------e2d9c52 [ObjectMapper] CS fixes
2 parents8531d2a +e2d9c52 commitf803dc1

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@
2929
finalclass ObjectMapperimplements 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
publicfunction__construct(
4137
privatereadonlyObjectMapperMetadataFactoryInterface$metadataFactory =newReflectionObjectMapperMetadataFactory(),
4238
privatereadonly ?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-
thrownewMappingTransformException(sprintf('Cannot map "%s" to a non-object target of type "%s".',get_debug_type($source),get_debug_type($mappedTarget)));
76+
thrownewMappingTransformException(\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

Lines 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-
(newObjectMapper())->map(newclass(){});
103+
(newObjectMapper())->map(newclass {});
104104
}
105105

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

214-
publicfunctiontestSourceOnly():void
214+
publicfunctiontestSourceOnly()
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 =newclass(){
223+
$a =newclass {
224224
publicfunction__get(string$key):string
225225
{
226226
returnmatch ($key) {
@@ -235,13 +235,12 @@ public function __get(string $key): string
235235
$this->assertSame('test',$mapped->mappedName);
236236
}
237237

238-
239-
publicfunctiontestTransformToWrongValueType():void
238+
publicfunctiontestTransformToWrongValueType()
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-
publicfunctiontestTransformToWrongObject():void
252+
publicfunctiontestTransformToWrongObject()
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([newMapping(target: ClassWithoutTarget::class, transform:fn() =>new \stdClass)]);
261+
$metadata->method('create')->with($u)->willReturn([newMapping(target: ClassWithoutTarget::class, transform:fn() =>new \stdClass())]);
263262
$mapper =newObjectMapper($metadata);
264263
$mapper->map($u);
265264
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp