8000 merged branch duplabe/customnormalizer-fix (PR #4273) · symfony/symfony@6fba6d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6fba6d7

Browse files
committed
merged branch duplabe/customnormalizer-fix (PR #4273)
Commits ------- e647eaa [Serializer] Fix CustomNormalizer supportsDenormalization interface check. Discussion ---------- [Serializer] Fix CustomNormalizer supportsDenormalization interface check. Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: - Todo: - License of the code: MIT Documentation PR: - Fixes the previous PR: #4257 --------------------------------------------------------------------------- by travisbot at 2012-05-13T20:57:00Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1322002) (merged e647eaa into 459942b).
2 parents de8a287 + e647eaa commit 6fba6d7

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ public function supportsDenormalization($data, $type, $format = null)
5959
{
6060
$class = new \ReflectionClass($type);
6161

62-
return $class->isSubclassOf('Symfony\Component\Serializer\Normalizer\NormalizableInterface');
62+
return $class->isSubclassOf('Symfony\Component\Serializer\Normalizer\DenormalizableInterface');
6363
}
6464
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Serializer\Tests\Fixtures;
13+
14+
use Symfony\Component\Serializer\Normalizer\DenormalizableInterface;
15+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
16+
17+
class DenormalizableDummy implements DenormalizableInterface
18+
{
19+
20+
function denormalize(DenormalizerInterface $denormalizer, $data, $format = null)
21+
{
22+
23+
}
24+
25+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
namespace Symfony\Component\Serializer\Tests\Fixtures;
1313

1414
use Symfony\Component\Serializer\Normalizer\NormalizableInterface;
15+
use Symfony\Component\Serializer\Normalizer\DenormalizableInterface;
1516
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
1617
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
1718

18-
class Dummy implements NormalizableInterface
19+
class Dummy implements NormalizableInterface, DenormalizableInterface
1920
{
2021
public $foo;
2122
public $bar;

src/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
namespace Symfony\Component\Serializer\Tests\Fixtures;
1313

1414
use Symfony\Component\Serializer\Normalizer\NormalizableInterface;
15+
use Symfony\Component\Serializer\Normalizer\DenormalizableInterface;
1516
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
1617
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
1718

18-
class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface
19+
class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface
1920
{
2021
public function normalize(NormalizerInterface $normalizer, $format = null)
2122
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ public function testSupportsDenormalization()
5353
{
5454
$this->assertTrue($this->normalizer->supportsDenormalization(array(), 'Symfony\Component\Serializer\Tests\Fixtures\ScalarDummy'));
5555
$this->assertFalse($this->normalizer->supportsDenormalization(array(), 'stdClass'));
56+
$this->assertTrue($this->normalizer->supportsDenormalization(array(), 'Symfony\Component\Serializer\Tests\Fixtures\DenormalizableDummy'));
5657
}
5758
}

0 commit comments

Comments
 (0)
0