Skip to content

Commit 101fad1

Browse files
Merge branch '6.0' into 6.1
* 6.0: CS fixes Bump Symfony version to 6.0.11 Update VERSION for 6.0.10 Update CHANGELOG for 6.0.10 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 1634ac0 + 8d9f588 commit 101fad1

10 files changed

+34
-35
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);
@@ -356,9 +356,9 @@ private function buildXml(\DOMNode $parentNode, mixed $data, string $format, arr
356356

357357
if (\is_array($data) || ($data instanceof \Traversable && (null === $this->serializer || !$this->serializer->supportsNormalization($data, $format)))) {
358358
foreach ($data as $key => $data) {
359-
//Ah this is the magic @ attribute types.
359+
// Ah this is the magic @ attribute types.
360360
if (str_starts_with($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) {
361-
if (!is_scalar($data)) {
361+
if (!\is_scalar($data)) {
362362
$data = $this->serializer->normalize($data, $format, $context);
363363
}
364364
$parentNode->setAttribute($attributeName, $data);
@@ -398,7 +398,7 @@ private function buildXml(\DOMNode $parentNode, mixed $data, string $format, arr
398398
}
399399

400400
$data = $this->serializer->normalize($data, $format, $context);
401-
if (null !== $data && !is_scalar($data)) {
401+
if (null !== $data && !\is_scalar($data)) {
402402
return $this->buildXml($parentNode, $data, $format, $context, $xmlRootNodeName);
403403
}
404404

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

Mapping/Loader/AnnotationLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function loadAnnotations(object $reflector): iterable
160160
try {
161161
yield $attribute->newInstance();
162162
} catch (\Error $e) {
163-
if ($e::class !== \Error::class) {
163+
if (\Error::class !== $e::class) {
164164
throw $e;
165165
}
166166
$on = match (true) {

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
@@ -200,7 +200,7 @@ public function normalize(mixed $object, string $format = null, array $context =
200200

201201
$attributeValue = $this->applyCallbacks($attributeValue, $object, $attribute, $format, $attributeContext);
202202

203-
if (null !== $attributeValue && !is_scalar($attributeValue)) {
203+
if (null !== $attributeValue && !\is_scalar($attributeValue)) {
204204
$stack[$attribute] = $attributeValue;
205205
}
206206

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/Context/Normalizer/ConstraintViolationListNormalizerContextBuilderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Serializer\Tests\Context\Normalizer;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
1615
use Symfony\Component\Serializer\Context\Normalizer\ConstraintViolationListNormalizerContextBuilder;
1716
use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer;
1817

Tests/Context/Normalizer/UidNormalizerContextBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\Serializer\Tests\Context\Normalizer;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
1615
use Symfony\Component\Serializer\Context\Normalizer\UidNormalizerContextBuilder;
16+
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
1717
use Symfony\Component\Serializer\Normalizer\UidNormalizer;
1818

1919
/**

Tests/Context/Normalizer/UnwrappingDenormalizerContextBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\Serializer\Tests\Context\Normalizer;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
1615
use Symfony\Component\Serializer\Context\Normalizer\UnwrappingDenormalizerContextBuilder;
16+
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
1717
use Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer;
1818

1919
/**
@@ -48,7 +48,7 @@ public function testWithers(array $values)
4848
public function withersDataProvider(): iterable
4949
{
5050
yield 'With values' => [[
51-
UnwrappingDenormalizer::UNWRAP_PATH => 'foo'
51+
UnwrappingDenormalizer::UNWRAP_PATH => 'foo',
5252
]];
5353

5454
yield 'With null values' => [[

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)