Skip to content

Commit 06b6ad0

Browse files
committed
fixed various inconsistencies
1 parent 6ac0840 commit 06b6ad0

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

Normalizer/CustomNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function normalize($object, $format = null, array $context = array())
2929
*/
3030
public function denormalize($data, $class, $format = null, array $context = array())
3131
{
32-
$object = new $class;
32+
$object = new $class();
3333
$object->denormalize($this->serializer, $data, $format, $context);
3434

3535
return $object;

Tests/Encoder/JsonEncoderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
1919
{
2020
protected function setUp()
2121
{
22-
$this->encoder = new JsonEncoder;
22+
$this->encoder = new JsonEncoder();
2323
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
2424
}
2525

2626
public function testEncodeScalar()
2727
{
28-
$obj = new \stdClass;
28+
$obj = new \stdClass();
2929
$obj->foo = "foo";
3030

3131
$expected = '{"foo":"foo"}';
@@ -68,7 +68,7 @@ protected function getJsonSource()
6868

6969
protected function getObject()
7070
{
71-
$obj = new \stdClass;
71+
$obj = new \stdClass();
7272
$obj->foo = 'foo';
7373
$obj->bar = array('a', 'b');
7474
$obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1)));

Tests/Encoder/XmlEncoderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
2424

2525
protected function setUp()
2626
{
27-
$this->encoder = new XmlEncoder;
27+
$this->encoder = new XmlEncoder();
2828
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
2929
$this->encoder->setSerializer($serializer);
3030
}
3131

3232
public function testEncodeScalar()
3333
{
34-
$obj = new ScalarDummy;
34+
$obj = new ScalarDummy();
3535
$obj->xmlFoo = "foo";
3636

3737
$expected = '<?xml version="1.0"?>'."\n".
@@ -42,7 +42,7 @@ public function testEncodeScalar()
4242

4343
public function testSetRootNodeName()
4444
{
45-
$obj = new ScalarDummy;
45+
$obj = new ScalarDummy();
4646
$obj->xmlFoo = "foo";
4747

4848
$this->encoder->setRootNodeName('test');
@@ -63,7 +63,7 @@ public function testDocTypeIsNotAllowed()
6363

6464
public function testAttributes()
6565
{
66-
$obj = new ScalarDummy;
66+
$obj = new ScalarDummy();
6767
$obj->xmlFoo = array(
6868
'foo-bar' => array(
6969
'@id' => 1,
@@ -92,7 +92,7 @@ public function testAttributes()
9292

9393
public function testElementNameValid()
9494
{
95-
$obj = new ScalarDummy;
95+
$obj = new ScalarDummy();
9696
$obj->xmlFoo = array(
9797
'foo-bar' => 'a',
9898
'foo_bar' => 'a',
@@ -345,7 +345,7 @@ protected function getXmlSource()
345345

346346
protected function getObject()
347347
{
348-
$obj = new Dummy;
348+
$obj = new Dummy();
349349
$obj->foo = 'foo';
350350
$obj->bar = array('a', 'b');
351351
$obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1)));

Tests/Normalizer/CustomNormalizerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class CustomNormalizerTest extends \PHPUnit_Framework_TestCase
1919
{
2020
protected function setUp()
2121
{
22-
$this->normalizer = new CustomNormalizer;
23-
$this->normalizer->setSerializer(new Serializer);
22+
$this->normalizer = new CustomNormalizer();
23+
$this->normalizer->setSerializer(new Serializer());
2424
}
2525

2626
public function testSerialize()
2727
{
28-
$obj = new ScalarDummy;
28+
$obj = new ScalarDummy();
2929
$obj->foo = 'foo';
3030
$obj->xmlFoo = 'xml';
3131
$this->assertEquals('foo', $this->normalizer->normalize($obj, 'json'));
@@ -34,19 +34,19 @@ public function testSerialize()
3434

3535
public function testDeserialize()
3636
{
37-
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy), 'xml');
37+
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy()), 'xml');
3838
$this->assertEquals('foo', $obj->xmlFoo);
3939
$this->assertNull($obj->foo);
4040

41-
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy), 'json');
41+
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy()), 'json');
4242
$this->assertEquals('foo', $obj->foo);
4343
$this->assertNull($obj->xmlFoo);
4444
}
4545

4646
public function testSupportsNormalization()
4747
{
48-
$this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy));
49-
$this->assertFalse($this->normalizer->supportsNormalization(new \stdClass));
48+
$this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy()));
49+
$this->assertFalse($this->normalizer->supportsNormalization(new \stdClass()));
5050
}
5151

5252
public function testSupportsDenormalization()

Tests/Normalizer/GetSetMethodNormalizerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
1717
{
1818
protected function setUp()
1919
{
20-
$this->normalizer = new GetSetMethodNormalizer;
20+
$this->normalizer = new GetSetMethodNormalizer();
2121
$this->normalizer->setSerializer($this->getMock('Symfony\Component\Serializer\Serializer'));
2222
}
2323

2424
public function testNormalize()
2525
{
26-
$obj = new GetSetDummy;
26+
$obj = new GetSetDummy();
2727
$obj->setFoo('foo');
2828
$obj->setBar('bar');
2929
$obj->setCamelCase('camelcase');
@@ -118,7 +118,7 @@ public function testIgnoredAttributes()
118118
{
119119
$this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase'));
120120

121-
$obj = new GetSetDummy;
121+
$obj = new GetSetDummy();
122122
$obj->setFoo('foo');
123123
$obj->setBar('bar');
124124

Tests/SerializerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ class SerializerTest extends \PHPUnit_Framework_TestCase
2828
public function testNormalizeNoMatch()
2929
{
3030
$this->serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer')));
31-
$this->serializer->normalize(new \stdClass, 'xml');
31+
$this->serializer->normalize(new \stdClass(), 'xml');
3232
}
3333

3434
public function testNormalizeTraversable()
3535
{
3636
$this->serializer = new Serializer(array(), array('json' => new JsonEncoder()));
37-
$result = $this->serializer->serialize(new TraversableDummy, 'json');
37+
$result = $this->serializer->serialize(new TraversableDummy(), 'json');
3838
$this->assertEquals('{"foo":"foo","bar":"bar"}', $result);
3939
}
4040

4141
public function testNormalizeGivesPriorityToInterfaceOverTraversable()
4242
{
43-
$this->serializer = new Serializer(array(new CustomNormalizer), array('json' => new JsonEncoder()));
44-
$result = $this->serializer->serialize(new NormalizableTraversableDummy, 'json');
43+
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
44+
$result = $this->serializer->serialize(new NormalizableTraversableDummy(), 'json');
4545
$this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result);
4646
}
4747

@@ -51,7 +51,7 @@ public function testNormalizeGivesPriorityToInterfaceOverTraversable()
5151
public function testNormalizeOnDenormalizer()
5252
{
5353
$this->serializer = new Serializer(array(new TestDenormalizer()), array());
54-
$this->assertTrue($this->serializer->normalize(new \stdClass, 'json'));
54+
$this->assertTrue($this->serializer->normalize(new \stdClass(), 'json'));
5555
}
5656

5757
/**

0 commit comments

Comments
 (0)