Skip to content

Commit

Permalink
Use Inline class to quote reserved characters
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Oct 31, 2013
1 parent bae3024 commit a5c0123
Showing 1 changed file with 4 additions and 7 deletions.
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Config\Definition\ScalarNode;
use Symfony\Component\Config\Definition\EnumNode;
use Symfony\Component\Config\Definition\PrototypedArrayNode;
use Symfony\Component\Yaml\Inline;

/**
* Dumps a Yaml reference configuration for the given configuration/node instance.
Expand Down Expand Up @@ -95,18 +96,14 @@ private function writeNode(NodeInterface $node, $depth = 0)
if ($node->hasDefaultValue()) {
$default = $node->getDefaultValue();

if (true === $default) {
$default = 'true';
} elseif (false === $default) {
$default = 'false';
} elseif (null === $default) {
$default = '~';
} elseif (is_array($default)) {
if (is_array($default)) {
if ($node->hasDefaultValue() && count($defaultArray = $node->getDefaultValue())) {
$default = '';
} elseif (!is_array($example)) {
$default = '[]';
}
} else {
$default = Inline::dump($default);
}
}
}
Expand Down

0 comments on commit a5c0123

Please sign in to comment.