@@ -57,9 +57,9 @@ class XmlEncoder implements EncoderInterface, DecoderInterface, NormalizationAwa
5757
5858 private $ defaultContext = [
5959 self ::AS_COLLECTION => false ,
60- self ::DECODER_IGNORED_NODE_TYPES => [XML_PI_NODE , XML_COMMENT_NODE ],
60+ self ::DECODER_IGNORED_NODE_TYPES => [\ XML_PI_NODE , \ XML_COMMENT_NODE ],
6161 self ::ENCODER_IGNORED_NODE_TYPES => [],
62- self ::LOAD_OPTIONS => LIBXML_NONET | LIBXML_NOBLANKS ,
62+ self ::LOAD_OPTIONS => \ LIBXML_NONET | \ LIBXML_NOBLANKS ,
6363 self ::REMOVE_EMPTY_TAGS => false ,
6464 self ::ROOT_NODE_NAME => 'response ' ,
6565 self ::TYPE_CAST_ATTRIBUTES => true ,
@@ -83,7 +83,7 @@ public function __construct(array $defaultContext = [])
8383 public function encode ($ data , string $ format , array $ context = [])
8484 {
8585 $ encoderIgnoredNodeTypes = $ context [self ::ENCODER_IGNORED_NODE_TYPES ] ?? $ this ->defaultContext [self ::ENCODER_IGNORED_NODE_TYPES ];
86- $ ignorePiNode = \in_array (XML_PI_NODE , $ encoderIgnoredNodeTypes , true );
86+ $ ignorePiNode = \in_array (\ XML_PI_NODE , $ encoderIgnoredNodeTypes , true );
8787 if ($ data instanceof \DOMDocument) {
8888 return $ data ->saveXML ($ ignorePiNode ? $ data ->documentElement : null );
8989 }
@@ -115,7 +115,7 @@ public function decode(string $data, string $format, array $context = [])
115115 }
116116
117117 $ internalErrors = libxml_use_internal_errors (true );
118- if (LIBXML_VERSION < 20900 ) {
118+ if (\ LIBXML_VERSION < 20900 ) {
119119 $ disableEntities = libxml_disable_entity_loader (true );
120120 }
121121 libxml_clear_errors ();
@@ -124,7 +124,7 @@ public function decode(string $data, string $format, array $context = [])
124124 $ dom ->loadXML ($ data , $ context [self ::LOAD_OPTIONS ] ?? $ this ->defaultContext [self ::LOAD_OPTIONS ]);
125125
126126 libxml_use_internal_errors ($ internalErrors );
127- if (LIBXML_VERSION < 20900 ) {
127+ if (\ LIBXML_VERSION < 20900 ) {
128128 libxml_disable_entity_loader ($ disableEntities );
129129 }
130130
@@ -137,7 +137,7 @@ public function decode(string $data, string $format, array $context = [])
137137 $ rootNode = null ;
138138 $ decoderIgnoredNodeTypes = $ context [self ::DECODER_IGNORED_NODE_TYPES ] ?? $ this ->defaultContext [self ::DECODER_IGNORED_NODE_TYPES ];
139139 foreach ($ dom ->childNodes as $ child ) {
140- if (XML_DOCUMENT_TYPE_NODE === $ child ->nodeType ) {
140+ if (\ XML_DOCUMENT_TYPE_NODE === $ child ->nodeType ) {
141141 throw new NotEncodableValueException ('Document types are not allowed. ' );
142142 }
143143 if (!$ rootNode && !\in_array ($ child ->nodeType , $ decoderIgnoredNodeTypes , true )) {
@@ -307,7 +307,7 @@ private function parseXmlAttributes(\DOMNode $node, array $context = []): array
307307 continue ;
308308 }
309309
310- if (false !== $ val = filter_var ($ attr ->nodeValue , FILTER_VALIDATE_INT )) {
310+ if (false !== $ val = filter_var ($ attr ->nodeValue , \ FILTER_VALIDATE_INT )) {
311311 $ data ['@ ' .$ attr ->nodeName ] = $ val ;
312312
313313 continue ;
@@ -330,7 +330,7 @@ private function parseXmlValue(\DOMNode $node, array $context = [])
330330 return $ node ->nodeValue ;
331331 }
332332
333- if (1 === $ node ->childNodes ->length && \in_array ($ node ->firstChild ->nodeType , [XML_TEXT_NODE , XML_CDATA_SECTION_NODE ])) {
333+ if (1 === $ node ->childNodes ->length && \in_array ($ node ->firstChild ->nodeType , [\ XML_TEXT_NODE , \ XML_CDATA_SECTION_NODE ])) {
334334 return $ node ->firstChild ->nodeValue ;
335335 }
336336
@@ -384,7 +384,7 @@ private function buildXml(\DOMNode $parentNode, $data, string $xmlRootNodeName =
384384 } elseif ('# ' === $ key ) {
385385 $ append = $ this ->selectNodeType ($ parentNode , $ data );
386386 } elseif ('#comment ' === $ key ) {
387- if (!\in_array (XML_COMMENT_NODE , $ encoderIgnoredNodeTypes , true )) {
387+ if (!\in_array (\ XML_COMMENT_NODE , $ encoderIgnoredNodeTypes , true )) {
388388 $ append = $ this ->appendComment ($ parentNode , $ data );
389389 }
390390 } elseif (\is_array ($ data ) && false === is_numeric ($ key )) {
0 commit comments