Skip to content

Commit eb11651

Browse files
committed
CS: Convert double quotes to single quotes
1 parent 1278aad commit eb11651

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

Encoder/XmlEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private function parseXml(\SimpleXMLElement $node)
277277
} else {
278278
$data['item'][] = $value;
279279
}
280-
} elseif (array_key_exists($key, $data) || $key == "entry") {
280+
} elseif (array_key_exists($key, $data) || $key == 'entry') {
281281
if ((false === is_array($data[$key])) || (false === isset($data[$key][0]))) {
282282
$data[$key] = array($data[$key]);
283283
}
@@ -308,7 +308,7 @@ private function buildXml(\DOMElement $parentNode, $data, $xmlRootNodeName = nul
308308
if (is_array($data) || $data instanceof \Traversable) {
309309
foreach ($data as $key => $data) {
310310
//Ah this is the magic @ attribute types.
311-
if (0 === strpos($key, "@") && is_scalar($data) && $this->isElementNameValid($attributeName = substr($key, 1))) {
311+
if (0 === strpos($key, '@') && is_scalar($data) && $this->isElementNameValid($attributeName = substr($key, 1))) {
312312
$parentNode->setAttribute($attributeName, $data);
313313
} elseif ($key === '#') {
314314
$append = $this->selectNodeType($parentNode, $data);
@@ -327,7 +327,7 @@ private function buildXml(\DOMElement $parentNode, $data, $xmlRootNodeName = nul
327327
$append = $this->appendNode($parentNode, $data, $key);
328328
}
329329
} elseif (is_numeric($key) || !$this->isElementNameValid($key)) {
330-
$append = $this->appendNode($parentNode, $data, "item", $key);
330+
$append = $this->appendNode($parentNode, $data, 'item', $key);
331331
} else {
332332
$append = $this->appendNode($parentNode, $data, $key);
333333
}

Tests/Encoder/JsonEncoderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function setUp()
2626
public function testEncodeScalar()
2727
{
2828
$obj = new \stdClass();
29-
$obj->foo = "foo";
29+
$obj->foo = 'foo';
3030

3131
$expected = '{"foo":"foo"}';
3232

@@ -47,14 +47,14 @@ public function testOptions()
4747
$context = array('json_encode_options' => JSON_NUMERIC_CHECK);
4848

4949
$arr = array();
50-
$arr['foo'] = "3";
50+
$arr['foo'] = '3';
5151

5252
$expected = '{"foo":3}';
5353

5454
$this->assertEquals($expected, $this->serializer->serialize($arr, 'json', $context));
5555

5656
$arr = array();
57-
$arr['foo'] = "3";
57+
$arr['foo'] = '3';
5858

5959
$expected = '{"foo":"3"}';
6060

@@ -72,7 +72,7 @@ protected function getObject()
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)));
75-
$obj->qux = "1";
75+
$obj->qux = '1';
7676

7777
return $obj;
7878
}

Tests/Encoder/XmlEncoderTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp()
3232
public function testEncodeScalar()
3333
{
3434
$obj = new ScalarDummy();
35-
$obj->xmlFoo = "foo";
35+
$obj->xmlFoo = 'foo';
3636

3737
$expected = '<?xml version="1.0"?>'."\n".
3838
'<response>foo</response>'."\n";
@@ -43,7 +43,7 @@ public function testEncodeScalar()
4343
public function testSetRootNodeName()
4444
{
4545
$obj = new ScalarDummy();
46-
$obj->xmlFoo = "foo";
46+
$obj->xmlFoo = 'foo';
4747

4848
$this->encoder->setRootNodeName('test');
4949
$expected = '<?xml version="1.0"?>'."\n".
@@ -70,11 +70,11 @@ public function testAttributes()
7070
'@name' => 'Bar',
7171
),
7272
'Foo' => array(
73-
'Bar' => "Test",
73+
'Bar' => 'Test',
7474
'@Type' => 'test',
7575
),
7676
'föo_bär' => 'a',
77-
"Bar" => array(1,2,3),
77+
'Bar' => array(1,2,3),
7878
'a' => 'b',
7979
);
8080
$expected = '<?xml version="1.0"?>'."\n".
@@ -275,28 +275,28 @@ public function testDecodeWithoutItemHash()
275275
$obj = new ScalarDummy();
276276
$obj->xmlFoo = array(
277277
'foo-bar' => array(
278-
'@key' => "value",
279-
'item' => array("@key" => 'key', "key-val" => 'val'),
278+
'@key' => 'value',
279+
'item' => array('@key' => 'key', 'key-val' => 'val'),
280280
),
281281
'Foo' => array(
282-
'Bar' => "Test",
282+
'Bar' => 'Test',
283283
'@Type' => 'test',
284284
),
285285
'föo_bär' => 'a',
286-
"Bar" => array(1,2,3),
286+
'Bar' => array(1,2,3),
287287
'a' => 'b',
288288
);
289289
$expected = array(
290290
'foo-bar' => array(
291-
'@key' => "value",
292-
'key' => array('@key' => 'key', "key-val" => 'val'),
291+
'@key' => 'value',
292+
'key' => array('@key' => 'key', 'key-val' => 'val'),
293293
),
294294
'Foo' => array(
295-
'Bar' => "Test",
295+
'Bar' => 'Test',
296296
'@Type' => 'test',
297297
),
298298
'föo_bär' => 'a',
299-
"Bar" => array(1,2,3),
299+
'Bar' => array(1,2,3),
300300
'a' => 'b',
301301
);
302302
$xml = $this->encoder->encode($obj, 'xml');
@@ -355,7 +355,7 @@ protected function getObject()
355355
$obj->foo = 'foo';
356356
$obj->bar = array('a', 'b');
357357
$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)));
358-
$obj->qux = "1";
358+
$obj->qux = '1';
359359

360360
return $obj;
361361
}

Tests/Normalizer/GetSetMethodNormalizerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function setCamelCase($camelCase)
275275

276276
public function otherMethod()
277277
{
278-
throw new \RuntimeException("Dummy::otherMethod() should not be called");
278+
throw new \RuntimeException('Dummy::otherMethod() should not be called');
279279
}
280280
}
281281

@@ -302,7 +302,7 @@ public function getBar()
302302

303303
public function otherMethod()
304304
{
305-
throw new \RuntimeException("Dummy::otherMethod() should not be called");
305+
throw new \RuntimeException('Dummy::otherMethod() should not be called');
306306
}
307307
}
308308

@@ -336,6 +336,6 @@ public function getBaz()
336336

337337
public function otherMethod()
338338
{
339-
throw new \RuntimeException("Dummy::otherMethod() should not be called");
339+
throw new \RuntimeException('Dummy::otherMethod() should not be called');
340340
}
341341
}

0 commit comments

Comments
 (0)