Skip to content

Commit bf59535

Browse files
committed
Fixed tests
1 parent 13815d7 commit bf59535

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Config\Definition\Dumper;
1313

1414
use Symfony\Component\Config\Definition\ArrayNode;
15+
use Symfony\Component\Config\Definition\BaseNode;
1516
use Symfony\Component\Config\Definition\ConfigurationInterface;
1617
use Symfony\Component\Config\Definition\EnumNode;
1718
use Symfony\Component\Config\Definition\NodeInterface;
@@ -76,7 +77,10 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null
7677
$default = '';
7778
$defaultArray = null;
7879
$children = null;
79-
$example = $node->getExample();
80+
$example = null;
81+
if ($node instanceof BaseNode) {
82+
$example = $node->getExample();
83+
}
8084

8185
// defaults
8286
if ($node instanceof ArrayNode) {
@@ -123,7 +127,7 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null
123127
}
124128

125129
// deprecated?
126-
if ($node->isDeprecated()) {
130+
if ($node instanceof BaseNode && $node->isDeprecated()) {
127131
$comments[] = sprintf('Deprecated (%s)', $node->getDeprecationMessage($node->getName(), $parentNode ? $parentNode->getPath() : $node->getPath()));
128132
}
129133

@@ -138,7 +142,7 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null
138142
$key = $prototypedArray ? '-' : $node->getName().':';
139143
$text = rtrim(sprintf('%-21s%s %s', $key, $default, $comments), ' ');
140144

141-
if ($info = $node->getInfo()) {
145+
if ($node instanceof BaseNode && $info = $node->getInfo()) {
142146
$this->writeLine('');
143147
// indenting multi-line info
144148
$info = str_replace("\n", sprintf("\n%".($depth * 4).'s# ', ' '), $info);

src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ enum: ~ # One of "this"; "that"
137137
138138
# Prototype
139139
name: []
140+
custom_node: true
140141

141142
EOL;
142143
}

0 commit comments

Comments
 (0)