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;
/**
return $rootName === $mapping[1];
});
- if (count($remapping)) {
+ if (\count($remapping)) {
list($singular) = current($remapping);
$rootName = $singular;
}
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;
$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);
}
// 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) {
// 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)));
}
*/
private function writeLine($text, $indent = 0)
{
- $indent = strlen($text) + $indent;
+ $indent = \strlen($text) + $indent;
$format = '%'.$indent.'s';
$this->reference .= sprintf($format, $text).PHP_EOL;
return '';
}
- if (is_string($value) || is_numeric($value)) {
+ if (\is_string($value) || is_numeric($value)) {
return $value;
}
return '';
}
- if (is_array($value)) {
+ if (\is_array($value)) {
return implode(',', $value);
}
}