[Serializer] Add `XmlEncoder::CDATA_WRAPPING` context option

by @AndoniLarz

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/49893/049982d1cdbdd0b422b2daf3decfb12ead2ca93e/cs.diff | patch -p0
diff -ru src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
--- src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php	2024-04-23 13:25:02.696190868 +0000
+++ src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php	2024-04-23 13:25:09.194418428 +0000
@@ -614,8 +614,8 @@
 XML;
 
         $expected = ['person' => [
-          ['firstname' => 'Benjamin', 'lastname' => 'Alexandre'],
-          ['firstname' => 'Damien', 'lastname' => 'Clay'],
+            ['firstname' => 'Benjamin', 'lastname' => 'Alexandre'],
+            ['firstname' => 'Damien', 'lastname' => 'Clay'],
         ]];
 
         $this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
@@ -638,8 +638,8 @@
 </people>
 XML;
         $expected = ['person' => [
-          ['firstname' => 'Benjamin', 'lastname' => 'Alexandre'],
-          ['firstname' => 'Damien', 'lastname' => 'Clay'],
+            ['firstname' => 'Benjamin', 'lastname' => 'Alexandre'],
+            ['firstname' => 'Damien', 'lastname' => 'Clay'],
         ]];
         $this->assertEquals($expected, $this->encoder->decode(
             $source,
@@ -673,8 +673,8 @@
         $this->encoder->setSerializer($serializer);
 
         $expected = ['person' => [
-          ['firstname' => 'Benjamin', 'lastname' => 'Alexandre', '#comment' => ' This comment should be decoded. '],
-          ['firstname' => 'Damien', 'lastname' => 'Clay'],
+            ['firstname' => 'Benjamin', 'lastname' => 'Alexandre', '#comment' => ' This comment should be decoded. '],
+            ['firstname' => 'Damien', 'lastname' => 'Clay'],
         ]];
 
         $this->assertEquals($expected, $this->encoder->decode($source, 'xml'));

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/49893/049982d1cdbdd0b422b2daf3decfb12ead2ca93e/exception_messages.diff | patch -p0
diff -ru src/Symfony/Component/Serializer/Encoder/XmlEncoder.php src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
--- src/Symfony/Component/Serializer/Encoder/XmlEncoder.php	2024-04-23 13:25:02.290176650 +0000
+++ src/Symfony/Component/Serializer/Encoder/XmlEncoder.php	2024-04-23 13:25:10.216454218 +0000
@@ -401,7 +401,7 @@
             return $this->appendNode($parentNode, $data, $format, $context, 'data');
         }
 
-        throw new NotEncodableValueException('An unexpected value could not be serialized: '.(!\is_resource($data) ? var_export($data, true) : sprintf('%s resource', get_resource_type($data))));
+        throw new NotEncodableValueException('An unexpected value could not be serialized: '.(!\is_resource($data) ? var_export($data, true) : sprintf('"%s" resource', get_resource_type($data))));
     }
 
     /**

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages