Skip to content

Commit 8d9f588

Browse files
Merge branch '5.4' into 6.0
* 5.4: CS fixes Bump Symfony version to 5.4.11 Update VERSION for 5.4.10 Update CHANGELOG for 5.4.10 Bump Symfony version to 4.4.44 Update VERSION for 4.4.43 Update CONTRIBUTORS for 4.4.43 Update CHANGELOG for 4.4.43
2 parents d01114d + 830bc47 commit 8d9f588

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
@@ -83,7 +83,7 @@ public function encode(mixed $data, string $format, array $context = []): string
8383

8484
$dom = $this->createDomDocument($context);
8585

86-
if (null !== $data && !is_scalar($data)) {
86+
if (null !== $data && !\is_scalar($data)) {
8787
$root = $dom->createElement($xmlRootNodeName);
8888
$dom->appendChild($root);
8989
$this->buildXml($root, $data, $format, $context, $xmlRootNodeName);
@@ -352,9 +352,9 @@ private function buildXml(\DOMNode $parentNode, mixed $data, string $format, arr
352352

353353
if (\is_array($data) || ($data instanceof \Traversable && (null === $this->serializer || !$this->serializer->supportsNormalization($data, $format)))) {
354354
foreach ($data as $key => $data) {
355-
//Ah this is the magic @ attribute types.
355+
// Ah this is the magic @ attribute types.
356356
if (str_starts_with($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) {
357-
if (!is_scalar($data)) {
357+
if (!\is_scalar($data)) {
358358
$data = $this->serializer->normalize($data, $format, $context);
359359
}
360360
$parentNode->setAttribute($attributeName, $data);
@@ -394,7 +394,7 @@ private function buildXml(\DOMNode $parentNode, mixed $data, string $format, arr
394394
}
395395

396396
$data = $this->serializer->normalize($data, $format, $context);
397-
if (null !== $data && !is_scalar($data)) {
397+
if (null !== $data && !\is_scalar($data)) {
398398
return $this->buildXml($parentNode, $data, $format, $context, $xmlRootNodeName);
399399
}
400400

@@ -417,7 +417,7 @@ private function buildXml(\DOMNode $parentNode, mixed $data, string $format, arr
417417
*/
418418
private function appendNode(\DOMNode $parentNode, mixed $data, string $format, array $context, string $nodeName, string $key = null): bool
419419
{
420-
$dom = $parentNode instanceof \DomDocument ? $parentNode : $parentNode->ownerDocument;
420+
$dom = $parentNode instanceof \DOMDocument ? $parentNode : $parentNode->ownerDocument;
421421
$node = $dom->createElement($nodeName);
422422
if (null !== $key) {
423423
$node->setAttribute('key', $key);

Normalizer/AbstractNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ protected function getGroups(array $context): array
254254
{
255255
$groups = $context[self::GROUPS] ?? $this->defaultContext[self::GROUPS] ?? [];
256256

257-
return is_scalar($groups) ? (array) $groups : $groups;
257+
return \is_scalar($groups) ? (array) $groups : $groups;
258258
}
259259

260260
/**

Normalizer/AbstractObjectNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function normalize(mixed $object, string $format = null, array $context =
198198

199199
$attributeValue = $this->applyCallbacks($attributeValue, $object, $attribute, $format, $attributeContext);
200200

201-
if (null !== $attributeValue && !is_scalar($attributeValue)) {
201+
if (null !== $attributeValue && !\is_scalar($attributeValue)) {
202202
$stack[$attribute] = $attributeValue;
203203
}
204204

Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function normalize(mixed $data, string $format = null, array $context = [
161161
return $normalizer->normalize($data, $format, $context);
162162
}
163163

164-
if (null === $data || is_scalar($data)) {
164+
if (null === $data || \is_scalar($data)) {
165165
return $data;
166166
}
167167

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
@@ -219,7 +219,7 @@ public function testSerializeEmpty()
219219
$serializer = new Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()]);
220220
$data = ['foo' => new \stdClass()];
221221

222-
//Old buggy behaviour
222+
// Old buggy behaviour
223223
$result = $serializer->serialize($data, 'json');
224224
$this->assertEquals('{"foo":[]}', $result);
225225

@@ -528,14 +528,14 @@ public function testNotNormalizableValueExceptionMessageForAResource()
528528
public function testNormalizeTransformEmptyArrayObjectToArray()
529529
{
530530
$serializer = new Serializer(
531-
[
532-
new PropertyNormalizer(),
533-
new ObjectNormalizer(),
534-
new ArrayDenormalizer(),
535-
],
536-
[
537-
'json' => new JsonEncoder(),
538-
]
531+
[
532+
new PropertyNormalizer(),
533+
new ObjectNormalizer(),
534+
new ArrayDenormalizer(),
535+
],
536+
[
537+
'json' => new JsonEncoder(),
538+
]
539539
);
540540

541541
$object = [];
@@ -551,14 +551,14 @@ public function testNormalizeTransformEmptyArrayObjectToArray()
551551
public function provideObjectOrCollectionTests()
552552
{
553553
$serializer = new Serializer(
554-
[
555-
new PropertyNormalizer(),
556-
new ObjectNormalizer(),
557-
new ArrayDenormalizer(),
558-
],
559-
[
560-
'json' => new JsonEncoder(),
561-
]
554+
[
555+
new PropertyNormalizer(),
556+
new ObjectNormalizer(),
557+
new ArrayDenormalizer(),
558+
],
559+
[
560+
'json' => new JsonEncoder(),
561+
]
562562
);
563563

564564
$data = [];

0 commit comments

Comments
 (0)