Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae771ad

Browse files
committed
bug#49760 [Serializer] Add missing withSaveOptions method to XmlEncoderContextBuilder (mtarld)
This PR was merged into the 6.3 branch.Discussion----------[Serializer] Add missing withSaveOptions method to XmlEncoderContextBuilder| Q | A| ------------- | ---| Branch? | 6.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |Add missing `withSaveOptions` method to `XmlEncoderContextBuilder` to handle `XmlEncoder::SAVE_OPTIONS` context value.Commits-------daf7c76 [Serializer] Add withSaveOptions to XmlEncoderContextBuilder
2 parents70b40fc +daf7c76 commitae771ad

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎src/Symfony/Component/Serializer/Context/Encoder/XmlEncoderContextBuilder.php‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ public function withLoadOptions(?int $loadOptions): static
8989
return$this->with(XmlEncoder::LOAD_OPTIONS,$loadOptions);
9090
}
9191

92+
/**
93+
* Configures the DOMDocument::saveXml options bitmask.
94+
*
95+
* @see https://www.php.net/manual/en/libxml.constants.php
96+
*
97+
* @param positive-int|null $saveOptions
98+
*/
99+
publicfunctionwithSaveOptions(?int$saveOptions):static
100+
{
101+
return$this->with(XmlEncoder::SAVE_OPTIONS,$saveOptions);
102+
}
103+
92104
/**
93105
* Configures whether to keep empty nodes.
94106
*/

‎src/Symfony/Component/Serializer/Tests/Context/Encoder/XmlEncoderContextBuilderTest.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function testWithers(array $values)
4141
->withEncoding($values[XmlEncoder::ENCODING])
4242
->withFormatOutput($values[XmlEncoder::FORMAT_OUTPUT])
4343
->withLoadOptions($values[XmlEncoder::LOAD_OPTIONS])
44+
->withSaveOptions($values[XmlEncoder::SAVE_OPTIONS])
4445
->withRemoveEmptyTags($values[XmlEncoder::REMOVE_EMPTY_TAGS])
4546
->withRootNodeName($values[XmlEncoder::ROOT_NODE_NAME])
4647
->withStandalone($values[XmlEncoder::STANDALONE])
@@ -63,6 +64,7 @@ public static function withersDataProvider(): iterable
6364
XmlEncoder::ENCODING =>'UTF-8',
6465
XmlEncoder::FORMAT_OUTPUT =>false,
6566
XmlEncoder::LOAD_OPTIONS => \LIBXML_COMPACT,
67+
XmlEncoder::SAVE_OPTIONS => \LIBXML_NOERROR,
6668
XmlEncoder::REMOVE_EMPTY_TAGS =>true,
6769
XmlEncoder::ROOT_NODE_NAME =>'root',
6870
XmlEncoder::STANDALONE =>false,
@@ -77,6 +79,7 @@ public static function withersDataProvider(): iterable
7779
XmlEncoder::ENCODING =>null,
7880
XmlEncoder::FORMAT_OUTPUT =>null,
7981
XmlEncoder::LOAD_OPTIONS =>null,
82+
XmlEncoder::SAVE_OPTIONS =>null,
8083
XmlEncoder::REMOVE_EMPTY_TAGS =>null,
8184
XmlEncoder::ROOT_NODE_NAME =>null,
8285
XmlEncoder::STANDALONE =>null,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp