Skip to content

Commit 68ce84e

Browse files
CS fixes
1 parent bd020a5 commit 68ce84e

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

Encoder/XmlEncoder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function encode($data, $format, array $context = [])
100100

101101
$dom = $this->createDomDocument($context);
102102

103-
if (null !== $data && !is_scalar($data)) {
103+
if (null !== $data && !\is_scalar($data)) {
104104
$root = $dom->createElement($xmlRootNodeName);
105105
$dom->appendChild($root);
106106
$this->buildXml($root, $data, $format, $context, $xmlRootNodeName);
@@ -412,9 +412,9 @@ private function buildXml(\DOMNode $parentNode, $data, string $format, array $co
412412

413413
if (\is_array($data) || ($data instanceof \Traversable && (null === $this->serializer || !$this->serializer->supportsNormalization($data, $format)))) {
414414
foreach ($data as $key => $data) {
415-
//Ah this is the magic @ attribute types.
415+
// Ah this is the magic @ attribute types.
416416
if (str_starts_with($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) {
417-
if (!is_scalar($data)) {
417+
if (!\is_scalar($data)) {
418418
$data = $this->serializer->normalize($data, $format, $context);
419419
}
420420
$parentNode->setAttribute($attributeName, $data);
@@ -454,7 +454,7 @@ private function buildXml(\DOMNode $parentNode, $data, string $format, array $co
454454
}
455455

456456
$data = $this->serializer->normalize($data, $format, $context);
457-
if (null !== $data && !is_scalar($data)) {
457+
if (null !== $data && !\is_scalar($data)) {
458458
return $this->buildXml($parentNode, $data, $format, $context, $xmlRootNodeName);
459459
}
460460

@@ -479,7 +479,7 @@ private function buildXml(\DOMNode $parentNode, $data, string $format, array $co
479479
*/
480480
private function appendNode(\DOMNode $parentNode, $data, string $format, array $context, string $nodeName, string $key = null): bool
481481
{
482-
$dom = $parentNode instanceof \DomDocument ? $parentNode : $parentNode->ownerDocument;
482+
$dom = $parentNode instanceof \DOMDocument ? $parentNode : $parentNode->ownerDocument;
483483
$node = $dom->createElement($nodeName);
484484
if (null !== $key) {
485485
$node->setAttribute('key', $key);

Normalizer/AbstractNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu
342342
}
343343

344344
$tmpGroups = $context[self::GROUPS] ?? $this->defaultContext[self::GROUPS] ?? null;
345-
$groups = (\is_array($tmpGroups) || is_scalar($tmpGroups)) ? (array) $tmpGroups : false;
345+
$groups = (\is_array($tmpGroups) || \is_scalar($tmpGroups)) ? (array) $tmpGroups : false;
346346
if (false === $groups && $allowExtraAttributes) {
347347
return false;
348348
}

Normalizer/AbstractObjectNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function normalize($object, $format = null, array $context = [])
196196

197197
$attributeValue = $this->applyCallbacks($attributeValue, $object, $attribute, $format, $context);
198198

199-
if (null !== $attributeValue && !is_scalar($attributeValue)) {
199+
if (null !== $attributeValue && !\is_scalar($attributeValue)) {
200200
$stack[$attribute] = $attributeValue;
201201
}
202202

Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function normalize($data, $format = null, array $context = [])
153153
return $normalizer->normalize($data, $format, $context);
154154
}
155155

156-
if (null === $data || is_scalar($data)) {
156+
if (null === $data || \is_scalar($data)) {
157157
return $data;
158158
}
159159

Tests/DeserializeNestedArrayOfObjectsTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class DeserializeNestedArrayOfObjectsTest extends TestCase
2323
public function provider()
2424
{
2525
return [
26-
//from property PhpDoc
26+
// from property PhpDoc
2727
[Zoo::class],
28-
//from argument constructor PhpDoc
28+
// from argument constructor PhpDoc
2929
[ZooImmutable::class],
3030
];
3131
}
@@ -35,7 +35,7 @@ public function provider()
3535
*/
3636
public function testPropertyPhpDoc($class)
3737
{
38-
//GIVEN
38+
// GIVEN
3939
$json = <<<EOF
4040
{
4141
"animals": [
@@ -47,10 +47,10 @@ public function testPropertyPhpDoc($class)
4747
new ObjectNormalizer(null, null, null, new PhpDocExtractor()),
4848
new ArrayDenormalizer(),
4949
], ['json' => new JsonEncoder()]);
50-
//WHEN
50+
// WHEN
5151
/** @var Zoo $zoo */
5252
$zoo = $serializer->deserialize($json, $class, 'json');
53-
//THEN
53+
// THEN
5454
self::assertCount(1, $zoo->getAnimals());
5555
self::assertInstanceOf(Animal::class, $zoo->getAnimals()[0]);
5656
}

Tests/SerializerTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function testSerializeEmpty()
214214
$serializer = new Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()]);
215215
$data = ['foo' => new \stdClass()];
216216

217-
//Old buggy behaviour
217+
// Old buggy behaviour
218218
$result = $serializer->serialize($data, 'json');
219219
$this->assertEquals('{"foo":[]}', $result);
220220

@@ -505,14 +505,14 @@ public function testNotNormalizableValueExceptionMessageForAResource()
505505
public function testNormalizeTransformEmptyArrayObjectToArray()
506506
{
507507
$serializer = new Serializer(
508-
[
509-
new PropertyNormalizer(),
510-
new ObjectNormalizer(),
511-
new ArrayDenormalizer(),
512-
],
513-
[
514-
'json' => new JsonEncoder(),
515-
]
508+
[
509+
new PropertyNormalizer(),
510+
new ObjectNormalizer(),
511+
new ArrayDenormalizer(),
512+
],
513+
[
514+
'json' => new JsonEncoder(),
515+
]
516516
);
517517

518518
$object = [];
@@ -526,14 +526,14 @@ public function testNormalizeTransformEmptyArrayObjectToArray()
526526
public function testNormalizePreserveEmptyArrayObject()
527527
{
528528
$serializer = new Serializer(
529-
[
530-
new PropertyNormalizer(),
531-
new ObjectNormalizer(),
532-
new ArrayDenormalizer(),
533-
],
534-
[
535-
'json' => new JsonEncoder(),
536-
]
529+
[
530+
new PropertyNormalizer(),
531+
new ObjectNormalizer(),
532+
new ArrayDenormalizer(),
533+
],
534+
[
535+
'json' => new JsonEncoder(),
536+
]
537537
);
538538

539539
$object = [];

0 commit comments

Comments
 (0)