X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fconfig%2FDefinition%2FDumper%2FXmlReferenceDumper.php;h=881457c923446ab1506765858316c35aedffec66;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=2cc71b344e35f3dd8f3912d46dcc4b6cd468dce5;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php b/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php index 2cc71b344..881457c92 100644 --- a/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php +++ b/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php @@ -11,10 +11,10 @@ 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; } @@ -96,13 +96,16 @@ class XmlReferenceDumper $rootAttributes[$key] = str_replace('-', ' ', $rootName).' '.$key; } - if ($prototype instanceof ArrayNode) { + if ($prototype instanceof PrototypedArrayNode) { + $prototype->setName($key); + $children = array($key => $prototype); + } elseif ($prototype instanceof ArrayNode) { $children = $prototype->getChildren(); } else { 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; @@ -150,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); } @@ -175,18 +182,18 @@ class XmlReferenceDumper // render comments // root node comment - if (count($rootComments)) { + if (\count($rootComments)) { foreach ($rootComments as $comment) { $this->writeLine('', $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) { @@ -201,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))); } @@ -258,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; @@ -277,7 +284,7 @@ class XmlReferenceDumper return ''; } - if (is_string($value) || is_numeric($value)) { + if (\is_string($value) || is_numeric($value)) { return $value; } @@ -297,7 +304,7 @@ class XmlReferenceDumper return ''; } - if (is_array($value)) { + if (\is_array($value)) { return implode(',', $value); } }