Skip to content

Commit 9104fd4

Browse files
committed
[Config] YamlReferenceDumper: No default value required for VariableNode with array example
1 parent 21ef411 commit 9104fd4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Config\Definition\NodeInterface;
1818
use Symfony\Component\Config\Definition\PrototypedArrayNode;
1919
use Symfony\Component\Config\Definition\ScalarNode;
20+
use Symfony\Component\Config\Definition\VariableNode;
2021
use Symfony\Component\Yaml\Inline;
2122

2223
/**
@@ -95,6 +96,9 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null
9596
} elseif ($node instanceof EnumNode) {
9697
$comments[] = 'One of '.implode('; ', array_map('json_encode', $node->getValues()));
9798
$default = $node->hasDefaultValue() ? Inline::dump($node->getDefaultValue()) : '~';
99+
} elseif (VariableNode::class === get_class($node) && \is_array($example)) {
100+
// If there is an array example, we are sure we dont need to print a default value
101+
$default = '';
98102
} else {
99103
$default = '~';
100104

0 commit comments

Comments
 (0)