Skip to content

Commit

Permalink
[Serializer] fixed CS (refs #7971)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 8, 2013
1 parent a5ab1aa commit e318759
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
8 changes: 2 additions & 6 deletions src/Symfony/Component/Serializer/Serializer.php
Expand Up @@ -173,9 +173,7 @@ public function supportsDenormalization($data, $type, $format = null)
private function getNormalizer($data, $format = null)
{
foreach ($this->normalizers as $normalizer) {
if ($normalizer instanceof NormalizerInterface
&& $normalizer->supportsNormalization($data, $format)
) {
if ($normalizer instanceof NormalizerInterface && $normalizer->supportsNormalization($data, $format)) {
return $normalizer;
}
}
Expand All @@ -189,9 +187,7 @@ private function getNormalizer($data, $format = null)
private function getDenormalizer($data, $type, $format = null)
{
foreach ($this->normalizers as $normalizer) {
if ($normalizer instanceof DenormalizerInterface
&& $normalizer->supportsDenormalization($data, $type, $format)
) {
if ($normalizer instanceof DenormalizerInterface && $normalizer->supportsDenormalization($data, $type, $format)) {
return $normalizer;
}
}
Expand Down
Expand Up @@ -20,19 +20,18 @@
*/
class TestDenormalizer implements DenormalizerInterface
{
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = null, array $context = array())
{
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = null, array $context = array())
{
}

}

/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null)
{
return TRUE;
}
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null)
{
return true;
}
}
Expand Up @@ -20,19 +20,18 @@
*/
class TestNormalizer implements NormalizerInterface
{
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = array())
{

}
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = array())
{
}

/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
{
return TRUE;
}
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
{
return true;
}
}
11 changes: 5 additions & 6 deletions src/Symfony/Component/Serializer/Tests/SerializerTest.php
Expand Up @@ -50,8 +50,8 @@ public function testNormalizeGivesPriorityToInterfaceOverTraversable()
*/
public function testNormalizeOnDenormalizer()
{
$this->serializer = new Serializer(array(new TestDenormalizer()), array());
$this->assertTrue($this->serializer->normalize(new \stdClass, 'json'));
$this->serializer = new Serializer(array(new TestDenormalizer()), array());
$this->assertTrue($this->serializer->normalize(new \stdClass, 'json'));
}

/**
Expand All @@ -68,9 +68,9 @@ public function testDenormalizeNoMatch()
*/
public function testDenormalizeOnNormalizer()
{
$this->serializer = new Serializer(array(new TestNormalizer()), array());
$data = array('title' => 'foo', 'numbers' => array(5, 3));
$this->assertTrue($this->serializer->denormalize(json_encode($data), 'stdClass', 'json'));
$this->serializer = new Serializer(array(new TestNormalizer()), array());
$data = array('title' => 'foo', 'numbers' => array(5, 3));
$this->assertTrue($this->serializer->denormalize(json_encode($data), 'stdClass', 'json'));
}

public function testSerialize()
Expand Down Expand Up @@ -244,5 +244,4 @@ public function toArray()
{
return array('title' => $this->title, 'numbers' => $this->numbers);
}

}

0 comments on commit e318759

Please sign in to comment.