From 001d0f16930491e7be15fb68ff090c1eb81dc1e8 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Tue, 1 Oct 2019 12:27:01 +0200 Subject: [PATCH] Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant --- src/Symfony/Component/Serializer/CHANGELOG.md | 1 + src/Symfony/Component/Serializer/Encoder/XmlEncoder.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Serializer/CHANGELOG.md b/src/Symfony/Component/Serializer/CHANGELOG.md index 1d747f628be28..9c8f1960d708c 100644 --- a/src/Symfony/Component/Serializer/CHANGELOG.md +++ b/src/Symfony/Component/Serializer/CHANGELOG.md @@ -17,6 +17,7 @@ CHANGELOG * removed `XmlEncoder::setRootNodeName()` & `XmlEncoder::getRootNodeName()`, use the default context instead. * removed individual encoders/normalizers options as constructor arguments. * removed support for instantiating a `DataUriNormalizer` with a default MIME type guesser when the `symfony/mime` component isn't installed. + * removed the `XmlEncoder::TYPE_CASE_ATTRIBUTES` constant. Use `XmlEncoder::TYPE_CAST_ATTRIBUTES` instead. 4.3.0 ----- diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 6b4c65f311b48..5c85007c56762 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -51,7 +51,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa const REMOVE_EMPTY_TAGS = 'remove_empty_tags'; const ROOT_NODE_NAME = 'xml_root_node_name'; const STANDALONE = 'xml_standalone'; - const TYPE_CASE_ATTRIBUTES = 'xml_type_cast_attributes'; + const TYPE_CAST_ATTRIBUTES = 'xml_type_cast_attributes'; const VERSION = 'xml_version'; private $defaultContext = [ @@ -61,7 +61,7 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa self::LOAD_OPTIONS => LIBXML_NONET | LIBXML_NOBLANKS, self::REMOVE_EMPTY_TAGS => false, self::ROOT_NODE_NAME => 'response', - self::TYPE_CASE_ATTRIBUTES => true, + self::TYPE_CAST_ATTRIBUTES => true, ]; /** @@ -293,7 +293,7 @@ private function parseXmlAttributes(\DOMNode $node, array $context = []): array } $data = []; - $typeCastAttributes = (bool) ($context[self::TYPE_CASE_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CASE_ATTRIBUTES]); + $typeCastAttributes = (bool) ($context[self::TYPE_CAST_ATTRIBUTES] ?? $this->defaultContext[self::TYPE_CAST_ATTRIBUTES]); foreach ($node->attributes as $attr) { if (!is_numeric($attr->nodeValue) || !$typeCastAttributes || (isset($attr->nodeValue[1]) && '0' === $attr->nodeValue[0])) {