Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 188eb34

Browse filesBrowse files
committed
Fix reference dump for deprecated nodes
1 parent 2e3df94 commit 188eb34
Copy full SHA for 188eb34

File tree

Expand file treeCollapse file tree

4 files changed

+12
-11
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+12
-11
lines changed

‎src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name
154154
}
155155

156156
if ($child->isDeprecated()) {
157-
$comments[] = sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $child->getPath()));
157+
$comments[] = sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath()));
158158
}
159159

160160
if ($child instanceof EnumNode) {

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ public function dumpNode(NodeInterface $node)
7070
}
7171

7272
/**
73-
* @param NodeInterface $node
74-
* @param int $depth
75-
* @param bool $prototypedArray
73+
* @param NodeInterface $node
74+
* @param NodeInterface|null $parentNode
75+
* @param int $depth
76+
* @param bool $prototypedArray
7677
*/
77-
private function writeNode(NodeInterface $node, $depth = 0, $prototypedArray = false)
78+
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, $depth = 0, $prototypedArray = false)
7879
{
7980
$comments = array();
8081
$default = '';
@@ -125,7 +126,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $prototypedArray = f
125126

126127
// deprecated?
127128
if ($node->isDeprecated()) {
128-
$comments[] = sprintf('Deprecated (%s)', $node->getDeprecationMessage($node->getName(), $node->getPath()));
129+
$comments[] = sprintf('Deprecated (%s)', $node->getDeprecationMessage($node->getName(), $parentNode ? $parentNode->getPath() : $node->getPath()));
129130
}
130131

131132
// example
@@ -171,7 +172,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $prototypedArray = f
171172

172173
if ($children) {
173174
foreach ($children as $childNode) {
174-
$this->writeNode($childNode, $depth + 1, $node instanceof PrototypedArrayNode && !$node->getKeyAttribute());
175+
$this->writeNode($childNode, $node, $depth + 1, $node instanceof PrototypedArrayNode && !$node->getKeyAttribute());
175176
}
176177
}
177178
}

‎src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ private function getConfigurationAsString()
3838
return str_replace("\n", PHP_EOL, <<<'EOL'
3939
<!-- Namespace: http://example.org/schema/dic/acme_root -->
4040
<!-- scalar-required: Required -->
41-
<!-- scalar-deprecated: Deprecated (The child node "scalar_deprecated" at path "acme_root.scalar_deprecated" is deprecated.) -->
42-
<!-- scalar-deprecated-with-message: Deprecated (Deprecation custom message for "scalar_deprecated_with_message" at "acme_root.scalar_deprecated_with_message") -->
41+
<!-- scalar-deprecated: Deprecated (The child node "scalar_deprecated" at path "acme_root" is deprecated.) -->
42+
<!-- scalar-deprecated-with-message: Deprecated (Deprecation custom message for "scalar_deprecated_with_message" at "acme_root") -->
4343
<!-- enum-with-default: One of "this"; "that" -->
4444
<!-- enum: One of "this"; "that" -->
4545
<config

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ private function getConfigurationAsString()
9898
- elem1
9999
- elem2
100100
scalar_required: ~ # Required
101-
scalar_deprecated: ~ # Deprecated (The child node "scalar_deprecated" at path "acme_root.scalar_deprecated" is deprecated.)
102-
scalar_deprecated_with_message: ~ # Deprecated (Deprecation custom message for "scalar_deprecated_with_message" at "acme_root.scalar_deprecated_with_message")
101+
scalar_deprecated: ~ # Deprecated (The child node "scalar_deprecated" at path "acme_root" is deprecated.)
102+
scalar_deprecated_with_message: ~ # Deprecated (Deprecation custom message for "scalar_deprecated_with_message" at "acme_root")
103103
node_with_a_looong_name: ~
104104
enum_with_default: this # One of "this"; "that"
105105
enum: ~ # One of "this"; "that"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.