Pull merge.
[yaffs-website] / vendor / symfony / config / Definition / Dumper / XmlReferenceDumper.php
index ec5460f2f53c7f286ec96b118ca6313abe430def..881457c923446ab1506765858316c35aedffec66 100644 (file)
 
 namespace Symfony\Component\Config\Definition\Dumper;
 
-use Symfony\Component\Config\Definition\ConfigurationInterface;
-use Symfony\Component\Config\Definition\NodeInterface;
 use Symfony\Component\Config\Definition\ArrayNode;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
 use Symfony\Component\Config\Definition\EnumNode;
+use Symfony\Component\Config\Definition\NodeInterface;
 use Symfony\Component\Config\Definition\PrototypedArrayNode;
 
 /**
@@ -58,7 +58,7 @@ class XmlReferenceDumper
                 return $rootName === $mapping[1];
             });
 
-            if (count($remapping)) {
+            if (\count($remapping)) {
                 list($singular) = current($remapping);
                 $rootName = $singular;
             }
@@ -105,7 +105,7 @@ class XmlReferenceDumper
                     if ($prototype->hasDefaultValue()) {
                         $prototypeValue = $prototype->getDefaultValue();
                     } else {
-                        switch (get_class($prototype)) {
+                        switch (\get_class($prototype)) {
                             case 'Symfony\Component\Config\Definition\ScalarNode':
                                 $prototypeValue = 'scalar value';
                                 break;
@@ -153,11 +153,15 @@ class XmlReferenceDumper
                         $comments[] = 'Required';
                     }
 
+                    if ($child->isDeprecated()) {
+                        $comments[] = sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath()));
+                    }
+
                     if ($child instanceof EnumNode) {
                         $comments[] = 'One of '.implode('; ', array_map('json_encode', $child->getValues()));
                     }
 
-                    if (count($comments)) {
+                    if (\count($comments)) {
                         $rootAttributeComments[$name] = implode(";\n", $comments);
                     }
 
@@ -178,18 +182,18 @@ class XmlReferenceDumper
         // render comments
 
         // root node comment
-        if (count($rootComments)) {
+        if (\count($rootComments)) {
             foreach ($rootComments as $comment) {
                 $this->writeLine('<!-- '.$comment.' -->', $depth);
             }
         }
 
         // attribute comments
-        if (count($rootAttributeComments)) {
+        if (\count($rootAttributeComments)) {
             foreach ($rootAttributeComments as $attrName => $comment) {
-                $commentDepth = $depth + 4 + strlen($attrName) + 2;
+                $commentDepth = $depth + 4 + \strlen($attrName) + 2;
                 $commentLines = explode("\n", $comment);
-                $multiline = (count($commentLines) > 1);
+                $multiline = (\count($commentLines) > 1);
                 $comment = implode(PHP_EOL.str_repeat(' ', $commentDepth), $commentLines);
 
                 if ($multiline) {
@@ -204,9 +208,9 @@ class XmlReferenceDumper
 
         // render start tag + attributes
         $rootIsVariablePrototype = isset($prototypeValue);
-        $rootIsEmptyTag = (0 === count($rootChildren) && !$rootIsVariablePrototype);
+        $rootIsEmptyTag = (0 === \count($rootChildren) && !$rootIsVariablePrototype);
         $rootOpenTag = '<'.$rootName;
-        if (1 >= ($attributesCount = count($rootAttributes))) {
+        if (1 >= ($attributesCount = \count($rootAttributes))) {
             if (1 === $attributesCount) {
                 $rootOpenTag .= sprintf(' %s="%s"', current(array_keys($rootAttributes)), $this->writeValue(current($rootAttributes)));
             }
@@ -261,7 +265,7 @@ class XmlReferenceDumper
      */
     private function writeLine($text, $indent = 0)
     {
-        $indent = strlen($text) + $indent;
+        $indent = \strlen($text) + $indent;
         $format = '%'.$indent.'s';
 
         $this->reference .= sprintf($format, $text).PHP_EOL;
@@ -280,7 +284,7 @@ class XmlReferenceDumper
             return '';
         }
 
-        if (is_string($value) || is_numeric($value)) {
+        if (\is_string($value) || is_numeric($value)) {
             return $value;
         }
 
@@ -300,7 +304,7 @@ class XmlReferenceDumper
             return '';
         }
 
-        if (is_array($value)) {
+        if (\is_array($value)) {
             return implode(',', $value);
         }
     }