8000 [Config] Handle nullable node name + fix inheritdocs · symfony/symfony@5c3e6a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c3e6a9

Browse files
ro0NLnicolas-grekas
authored andcommitted
[Config] Handle nullable node name + fix inheritdocs
1 parent 87bbe5e commit 5c3e6a9

File tree

7 files changed

+52
-68
lines changed

7 files changed

+52
-68
lines changed

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,23 @@ public function setIgnoreExtraKeys($boolean)
150150
}
151151

152152
/**
153-
* Sets the node Name.
154-
*
155-
* @param string $name The node's name
153+
* {@inheritdoc}
156154
*/
157155
public function setName($name)
158156
{
159157
$this->name = $name;
160158
}
161159

162160
/**
163-
* Checks if the node has a default value.
164-
*
165-
* @return bool
161+
* {@inheritdoc}
166162
*/
167163
public function hasDefaultValue()
168164
{
169165
return $this->addIfNotSet;
170166
}
171167

172168
/**
173-
* Retrieves the default value.
174-
*
175-
* @return array The default value
176-
*
177-
* @throws \RuntimeException if the node has no default value
169+
* {@inheritdoc}
178170
*/
179171
public function getDefaultValue()
180172
{

src/Symfony/Component/Config/Definition/BaseNode.php

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ abstract class BaseNode implements NodeInterface
4040
*/
4141
public function __construct($name, NodeInterface $parent = null)
4242
{
43-
if (false !== strpos($name, '.')) {
43+
if (false !== strpos($name = (string) $name, '.')) {
4444
throw new \InvalidArgumentException('The name must not contain ".".');
4545
}
4646

@@ -170,29 +170,23 @@ public function setFinalValidationClosures(array $closures)
170170
}
171171

172172
/**
173-
* Checks if this node is required.
174-
*
175-
* @return bool
173+
* {@inheritdoc}
D7AE 176174
*/
177175
public function isRequired()
178176
{
179177
return $this->required;
180178
}
181179

182180
/**
183-
* Returns the name of this node.
184-
*
185-
* @return string The Node's name
181+
* {@inheritdoc}
186182
*/
187183
public function getName()
188184
{
189185
return $this->name;
190186
}
191187

192188
/**
193-
* Retrieves the path of this node.
194-
*
195-
* @return string The Node's path
189+
* {@inheritdoc}
196190
*/
197191
public function getPath()
198192
{
@@ -206,14 +200,7 @@ public function getPath()
206200
}
207201

208202
/**
209-
* Merges two values together.
210-
*
211-
* @param mixed $leftSide
212-
* @param mixed $rightSide
213-
*
214-
* @return mixed The merged value
215-
*
216-
* @throws ForbiddenOverwriteException
203+
* {@inheritdoc}
217204
*/
218205
final public function merge($leftSide, $rightSide)
219206
{
@@ -233,11 +220,7 @@ final public function merge($leftSide, $rightSide)
233220
}
234221

235222
/**
236-
* Normalizes a value, applying all normalization closures.
237-
*
238-
* @param mixed $value Value to normalize
239-
*
240-
* @return mixed The normalized value
223+
* {@inheritdoc}
241224
*/
242225
final public function normalize($value)
243226
{
@@ -285,14 +268,7 @@ public function getParent()
285268
}
286269

287270
/**
288-
* Finalizes a value, applying all finalization closures.
289-
*
290-
* @param mixed $value The value to finalize
291-
*
292-
* @return mixed The finalized value
293-
*
294-
* @throws Exception
295-
* @throws InvalidConfigurationException
271+
* {@inheritdoc}
296272
*/
297273
final public function finalize($value)
298274
{

src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,15 @@ public function __construct($name, NodeParentInterface $parent = null)
4747
}
4848

4949
/**
50-
* Sets a custom children builder.
50+
* {@inheritdoc}
5151
*/
5252
public function setBuilder(NodeBuilder $builder)
5353
{
5454
$this->nodeBuilder = $builder;
5555
}
5656

5757
/**
58-
* Returns a builder to add children nodes.
59-
*
60-
* @return NodeBuilder
58+
* {@inheritdoc}
6159
*/
6260
public function children()
6361
{
@@ -306,17 +304,7 @@ public function normalizeKeys($bool)
306304
}
307305

308306
/**
309-
* Appends a node definition.
310-
*
311-
* $node = new ArrayNodeDefinition()
312-
* ->children()
313-
* ->scalarNode('foo')->end()
314-
* ->scalarNode('baz')->end()
315-
* ->end()
316-
* ->append($this->getBarNodeDefinition())
317-
* ;
318-
*
319-
* @return $this
307+
* {@inheritdoc}
320308
*/
321309
public function append(NodeDefinition $node)
322310
{

src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,32 @@
1818
*/
1919
interface ParentNodeDefinitionInterface
2020
{
21+
/**
22+
* Returns a builder to add children nodes.
23+
*
24+
* @return NodeBuilder
25+
*/
2126
public function children();
2227

28+
/**
29+
* Appends a node definition.
30+
*
31+
* Usage:
32+
*
33+
* $node = $parentNode
34+
* ->children()
35+
* ->scalarNode('foo')->end()
36+
* ->scalarNode('baz')->end()
37+
* ->append($this->getBarNodeDefinition())
38+
* ->end()
39+
* ;
40+
*
41+
* @return $this
42+
*/
2343
public function append(NodeDefinition $node);
2444

45+
/**
46+
* Sets a custom children builder.
47+
*/
2548
public function setBuilder(NodeBuilder $builder);
2649
}

src/Symfony/Component/Config/Definition/NodeInterface.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
namespace Symfony\Component\Config\Definition;
1313

14+
use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException;
15+
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
16+
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
17+
1418
/**
1519
* Common Interface among all nodes.
1620
*
@@ -59,11 +63,13 @@ public function hasDefaultValue();
5963
public function getDefaultValue();
6064

6165
/**
62-
* Normalizes the supplied value.
66+
* Normalizes a value.
6367
*
6468
* @param mixed $value The value to normalize
6569
*
6670
* @return mixed The normalized value
71+
*
72+
* @throws InvalidTypeException if the value type is invalid
6773
*/
6874
public function normalize($value);
6975

@@ -73,7 +79,10 @@ public function normalize($value);
7379
* @param mixed $leftSide
7480
* @param mixed $rightSide
7581
*
76-
* @return mixed The merged values
82+
* @return mixed The merged value
83+
*
84+
* @throws ForbiddenOverwriteException if the configuration path cannot be overwritten
85+
* @throws InvalidTypeException if the value type is invalid
7786
*/
7887
public function merge($leftSide, $rightSide);
7988

@@ -83,6 +92,9 @@ public function merge($leftSide, $rightSide);
8392
* @param mixed $value The value to finalize
8493
*
8594
* @return mixed The finalized value
95+
*
96+
* @throws InvalidTypeException if the value type is invalid
97+
* @throws InvalidConfigurationException if the value is invalid configuration
8698
*/
8799
public function finalize($value);
88100
}

src/Symfony/Component/Config/Definition/PrototypedArrayNode.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ public function setDefaultValue($value)
102102
}
103103

104104
/**
105-
* Checks if the node has a default value.
106-
*
107-
* @return bool
105+
* {@inheritdoc}
108106
*/
109107
public function hasDefaultValue()
110108
{
@@ -126,12 +124,10 @@ public function setAddChildrenIfNoneSet($children = array('defaults'))
126124
}
127125

128126
/**
129-
* Retrieves the default value.
127+
* {@inheritdoc}
130128
*
131129
* The default value could be either explicited or derived from the prototype
132130
* default value.
133-
*
134-
* @return array The default value
135131
*/
136132
public function getDefaultValue()
137133
{

src/Symfony/Component/Config/Definition/VariableNode.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
2727
protected $defaultValue;
2828
protected $allowEmptyValue = true;
2929

30-
/**
31-
* {@inheritdoc}
32-
*/
3330
public function setDefaultValue($value)
3431
{
3532
$this->defaultValueSet = true;

0 commit comments

Comments
 (0)
0