8000 require a (de)normalizer inside the (de)normalizable interfaces inste… · symfony/symfony@351eaa8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 351eaa8

Browse files
committed
require a (de)normalizer inside the (de)normalizable interfaces instead of a serializer
1 parent c3d6123 commit 351eaa8

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Symfony\Component\Serializer\Normalizer;
44

5-
use Symfony\Component\Serializer\SerializerInterface;
6-
75
/*
86
* This file is part of the Symfony framework.
97
*
@@ -29,11 +27,11 @@ interface DenormalizableInterface
2927
* It is important to understand that the normalize() call should denormalize
3028
* recursively all child objects of the implementor.
3129
*
32-
* @param SerializerInterface $serializer The serializer is given so that you
30+
* @param DenormalizerInterface $denormalizer The denormalizer is given so that you
3331
* can use it to denormalize objects contained within this object.
3432
* @param array|scalar $data The data from which to re-create the object.
3533
* @param string|null $format The format is optionally given to be able to denormalize differently
3634
* based on different input formats.
3735
*/
38-
function denormalize(SerializerInterface $serializer, $data, $format = null);
36+
function denormalize(DenormalizerInterface $denormalizer, $data, $format = null);
3937
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Symfony\Component\Serializer\Normalizer;
44

5-
use Symfony\Component\Serializer\SerializerInterface;
6-
75
/*
86
* This file is part of the Symfony framework.
97
*
@@ -29,11 +27,11 @@ interface NormalizableInterface
2927
* It is important to understand that the normalize() call should normalize
3028
* recursively all child objects of the implementor.
3129
*
32-
* @param SerializerInterface $serializer The serializer is given so that you
30+
* @param NormalizerInterface $normalizer The normalizer is given so that you
3331
* can use it to normalize objects contained within this object.
3432
* @param string|null $format The format is optionally given to be able to normalize differently
3533
* based on different output formats.
3634
* @return array|scalar
3735
*/
38-
function normalize(SerializerInterface $serializer, $format = null);
36+
function normalize(NormalizerInterface $normalizer, $format = null);
3937
}

tests/Symfony/Tests/Component/Serializer/Fixtures/Dummy.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
namespace Symfony\Tests\Component\Serializer\Fixtures;
44

55
use Symfony\Component\Serializer\Normalizer\NormalizableInterface;
6-
use Symfony\Component\Serializer\SerializerInterface;
6+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
7+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
78

89
class Dummy implements NormalizableInterface
910
{
@@ -12,7 +13,7 @@ class Dummy implements NormalizableInterface
1213
public $baz;
1314
public $qux;
1415

15-
public function normalize(SerializerInterface $serializer, $format = null)
16+
public function normalize(NormalizerInterface $normalizer, $format = null)
1617
{
1718
return array(
1819
'foo' => $this->foo,
@@ -22,7 +23,7 @@ public function normalize(SerializerInterface $serializer, $format = null)
2223
);
2324
}
2425

25-
public function denormalize(SerializerInterface $serializer, $data, $format = null)
26+
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
2627
{
2728
$this->foo = $data['foo'];
2829
$this->bar = $data['bar'];

tests/Symfony/Tests/Component/Serializer/Fixtures/ScalarDummy.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
namespace Symfony\Tests\Component\Serializer\Fixtures;
44

55
use Symfony\Component\Serializer\Normalizer\NormalizableInterface;
6-
use Symfony\Component\Serializer\SerializerInterface;
6+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
7+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
78

89
class ScalarDummy implements NormalizableInterface
910
{
1011
public $foo;
1112
public $xmlFoo;
1213

13-
public function normalize(SerializerInterface $serializer, $format = null)
14+
public function normalize(NormalizerInterface $normalizer, $format = null)
1415
{
1516
return $format === 'xml' ? $this->xmlFoo : $this->foo;
1617
}
1718

18-
public function denormalize(SerializerInterface $serializer, $data, $format = null)
19+
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
1920
{
2021
if ($format === 'xml') {
2122
$this->xmlFoo = $data;

0 commit comments

Comments
 (0)
0