8000 Apply Fixes from Fabbot · symfony/symfony@4b01189 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 4b01189

Browse files
Apply Fixes from Fabbot
1 parent a556875 commit 4b01189

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,9 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
319319
$format = null;
320320
}
321321

322-
if (null != $object = $this->extractObjectToPopulate($class, $context, static::OBJECT_TO_POPULATE)) {
322+
if (null !== $object = $this->extractObjectToPopulate($class, $context, static::OBJECT_TO_POPULATE)) {
323323
unset($context[static::OBJECT_TO_POPULATE]);
324+
324325
return $object;
325326
}
326327

src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ trait ObjectToPopulateTrait
2020
* @param string $class The class the object should be
2121
* @param $context The denormalization context
2222
* @param string $key They in which to look for the object to populate.
23-
* Keeps backwards compatability with `AbstractNormalizer.
23+
* Keeps backwards compatability with `AbstractNormalizer.
24+
*
2425
* @return object|null An object if things check out, null otherwise.
2526
*/
26-
protected function extractObjectToPopulate($class, array $context, $key=null)
27+
protected function extractObjectToPopulate($class, array $context, $key = null)
2728
{
2829
$key = $key ?: 'object_to_populate';
2930

src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public function testDeserialize()
5959
public function testDenormalizeWithObjectToPopulateUsesProvidedObject()
6060
{
6161
$expected = new ScalarDummy();
62-
$obj = $this->normalizer->denormalize('foo', ScalarDummy::class, 'json', [
62+
$obj = $this->normalizer->denormalize('foo', ScalarDummy::class, 'json', array(
6363
'object_to_populate' => $expected,
64-
]);
64+
));
6565

6666
$this->assertSame($expected, $obj);
6767
$this->assertEquals('foo', $obj->foo);

src/Symfony/Component/Serializer/Tests/Normalizer/ObjectToPopulateTraitTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@ class ObjectToPopulateTraitTest extends TestCase
1212

1313
public function testExtractObjectToPopulateReturnsNullWhenKeyIsMissing()
1414
{
15-
$object = $this->extractObjectToPopulate(ProxyDummy::class, []);
15+
$object = $this->extractObjectToPopulate(ProxyDummy::class, array());
1616

1717
$this->assertNull($object);
1818
}
1919

2020
public function testExtractObjectToPopulateReturnsNullWhenNonObjectIsProvided()
2121
{
22-
$object = $this->extractObjectToPopulate(ProxyDummy::class, [
22+
$object = $this->extractObjectToPopulate(ProxyDummy::class, array(
2323
'object_to_populate' => 'not an object',
24-
]);
24+
));
2525

2626
$this->assertNull($object);
2727
}
2828

2929
public function testExtractObjectToPopulateReturnsNullWhenTheClassIsNotAnInstanceOfTheProvidedClass()
3030
{
31-
$object = $this->extractObjectToPopulate(ProxyDummy::class, [
31+
$object = $this->extractObjectToPopulate(ProxyDummy::class, array(
3232
'object_to_populate' => new \stdClass(),
33-
]);
33+
));
3434

3535
$this->assertNull($object);
3636
}
3737

3838
public function testExtractObjectToPopulateReturnsObjectWhenEverythingChecksOut()
3939
{
4040
$expected = new ProxyDummy();
41-
$object = $this->extractObjectToPopulate(ProxyDummy::class, [
41+
$object = $this->extractObjectToPopulate(ProxyDummy::class, array(
4242
'object_to_populate' => $expected,
43-
]);
43+
));
4444

4545
$this->assertSame($expected, $object);
4646
}

0 commit comments

Comments
 (0)
0