8000 minor #33788 [Serializer] Remove XmlEncoder::TYPE_CASE_ATTRIBUTES con… · symfony/symfony@00792fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 00792fc

Browse files
minor #33788 [Serializer] Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant (pierredup)
This PR was merged into the 5.0-dev branch. Discussion ---------- [Serializer] Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | not really | Deprecations? | yes (well, sort of) | Tickets | N/A | License | MIT | Doc PR | N/A There is a small typo in the `XmlEncoder` constant. This can only be fixed in the master branch for Symfony 5 as it is a breaking change. I'm not sure if it's possible to deprecate the usage of the old constant name in 4.4? As the constant just resolves to a string, there is no way of determining if someone used the constant or not (a quick search on Github, I can't find any direct usages of the constant outside of this class) Commits ------- 001d0f1 Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant
2 parents a176d1a + 001d0f1 commit 00792fc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ CHANGELOG
1717
* removed `XmlEncoder::setRootNodeName()` & `XmlEncoder::getRootNodeName()`, use the default context instead.
1818
* removed individual encoders/normalizers options as constructor arguments.
1919
* removed support for instantiating a `DataUriNormalizer` with a default MIME type guesser when the `symfony/mime` component isn't installed.
20+
* removed the `XmlEncoder::TYPE_CASE_ATTRIBUTES` constant. Use `XmlEncoder::TYPE_CAST_ATTRIBUTES` instead.
2021

2122
4.3.0
2223
-----

src/Symfony/Component/Serializer/Encoder/XmlEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
5151
const REMOVE_EMPTY_TAGS = 'remove_empty_tags';
5252
const ROOT_NODE_NAME = 'xml_root_node_name';
5353
const STANDALONE = 'xml_standalone';
54-
const TYPE_CASE_ATTRIBUTES = 'xml_type_cast_attributes';
54+
const TYPE_CAST_ATTRIBUTES = 'xml_type_cast_attributes';
5555
const VERSION = 'xml_version';
5656

5757
private $defaultContext = [
@@ -61,7 +61,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
6161
self::LOAD_OPTIONS => LIBXML_NONET | LIBXML_NOBLANKS,
6262
self::REMOVE_EMPTY_TAGS => false,
6363
self::ROOT_NODE_NAME => 'response',
64-
self::TYPE_CASE_ATTRIBUTES => true,
64+
self::TYPE_CAST_ATTRIBUTES => true,
6565
];
6666

6767
/**
@@ -293,7 +293,7 @@ private function parseXmlAttributes(\DOMNode $node, array $context = []): array
293293
}
294294

295295
$data = [];
296-
$typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]);
296+
$typeCastAttributes = (bool) ($context[self::TYPE_CAST_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CAST_ATTRIBUTES]);
297297

298298
foreach ($node->attributes as $attr) {
299299
if (!is_numeric($attr->nodeValue) || !$typeCastAttributes || (isset($attr->nodeValue[1]) && '0' === $attr->nodeValue[0])) {

0 commit comments

Comments
 (0)
0