[Config] Handle nullable node name + fix inheritdocs
This commit is contained in:
parent
87bbe5ef5f
commit
5c3e6a95b3
@ -150,9 +150,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the node Name.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param string $name The node's name
|
|
||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
@ -160,9 +158,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the node has a default value.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasDefaultValue()
|
public function hasDefaultValue()
|
||||||
{
|
{
|
||||||
@ -170,11 +166,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the default value.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return array The default value
|
|
||||||
*
|
|
||||||
* @throws \RuntimeException if the node has no default value
|
|
||||||
*/
|
*/
|
||||||
public function getDefaultValue()
|
public function getDefaultValue()
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
*/
|
*/
|
||||||
public function __construct($name, NodeInterface $parent = null)
|
public function __construct($name, NodeInterface $parent = null)
|
||||||
{
|
{
|
||||||
if (false !== strpos($name, '.')) {
|
if (false !== strpos($name = (string) $name, '.')) {
|
||||||
throw new \InvalidArgumentException('The name must not contain ".".');
|
throw new \InvalidArgumentException('The name must not contain ".".');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,9 +170,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this node is required.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isRequired()
|
public function isRequired()
|
||||||
{
|
{
|
||||||
@ -180,9 +178,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of this node.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return string The Node's name
|
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
@ -190,9 +186,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the path of this node.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return string The Node's path
|
|
||||||
*/
|
*/
|
||||||
public function getPath()
|
public function getPath()
|
||||||
{
|
{
|
||||||
@ -206,14 +200,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges two values together.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param mixed $leftSide
|
|
||||||
* @param mixed $rightSide
|
|
||||||
*
|
|
||||||
* @return mixed The merged value
|
|
||||||
*
|
|
||||||
* @throws ForbiddenOverwriteException
|
|
||||||
*/
|
*/
|
||||||
final public function merge($leftSide, $rightSide)
|
final public function merge($leftSide, $rightSide)
|
||||||
{
|
{
|
||||||
@ -233,11 +220,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes a value, applying all normalization closures.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param mixed $value Value to normalize
|
|
||||||
*
|
|
||||||
* @return mixed The normalized value
|
|
||||||
*/
|
*/
|
||||||
final public function normalize($value)
|
final public function normalize($value)
|
||||||
{
|
{
|
||||||
@ -285,14 +268,7 @@ abstract class BaseNode implements NodeInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalizes a value, applying all finalization closures.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param mixed $value The value to finalize
|
|
||||||
*
|
|
||||||
* @return mixed The finalized value
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
* @throws InvalidConfigurationException
|
|
||||||
*/
|
*/
|
||||||
final public function finalize($value)
|
final public function finalize($value)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a custom children builder.
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function setBuilder(NodeBuilder $builder)
|
public function setBuilder(NodeBuilder $builder)
|
||||||
{
|
{
|
||||||
@ -55,9 +55,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a builder to add children nodes.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return NodeBuilder
|
|
||||||
*/
|
*/
|
||||||
public function children()
|
public function children()
|
||||||
{
|
{
|
||||||
@ -306,17 +304,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a node definition.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* $node = new ArrayNodeDefinition()
|
|
||||||
* ->children()
|
|
||||||
* ->scalarNode('foo')->end()
|
|
||||||
* ->scalarNode('baz')->end()
|
|
||||||
* ->end()
|
|
||||||
* ->append($this->getBarNodeDefinition())
|
|
||||||
* ;
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
*/
|
||||||
public function append(NodeDefinition $node)
|
public function append(NodeDefinition $node)
|
||||||
{
|
{
|
||||||
|
@ -18,9 +18,32 @@ namespace Symfony\Component\Config\Definition\Builder;
|
|||||||
*/
|
*/
|
||||||
interface ParentNodeDefinitionInterface
|
interface ParentNodeDefinitionInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Returns a builder to add children nodes.
|
||||||
|
*
|
||||||
|
* @return NodeBuilder
|
||||||
|
*/
|
||||||
public function children();
|
public function children();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a node definition.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* $node = $parentNode
|
||||||
|
* ->children()
|
||||||
|
* ->scalarNode('foo')->end()
|
||||||
|
* ->scalarNode('baz')->end()
|
||||||
|
* ->append($this->getBarNodeDefinition())
|
||||||
|
* ->end()
|
||||||
|
* ;
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
public function append(NodeDefinition $node);
|
public function append(NodeDefinition $node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a custom children builder.
|
||||||
|
*/
|
||||||
public function setBuilder(NodeBuilder $builder);
|
public function setBuilder(NodeBuilder $builder);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Config\Definition;
|
namespace Symfony\Component\Config\Definition;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException;
|
||||||
|
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
||||||
|
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common Interface among all nodes.
|
* Common Interface among all nodes.
|
||||||
*
|
*
|
||||||
@ -59,11 +63,13 @@ interface NodeInterface
|
|||||||
public function getDefaultValue();
|
public function getDefaultValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes the supplied value.
|
* Normalizes a value.
|
||||||
*
|
*
|
||||||
* @param mixed $value The value to normalize
|
* @param mixed $value The value to normalize
|
||||||
*
|
*
|
||||||
* @return mixed The normalized value
|
* @return mixed The normalized value
|
||||||
|
*
|
||||||
|
* @throws InvalidTypeException if the value type is invalid
|
||||||
*/
|
*/
|
||||||
public function normalize($value);
|
public function normalize($value);
|
||||||
|
|
||||||
@ -73,7 +79,10 @@ interface NodeInterface
|
|||||||
* @param mixed $leftSide
|
* @param mixed $leftSide
|
||||||
* @param mixed $rightSide
|
* @param mixed $rightSide
|
||||||
*
|
*
|
||||||
* @return mixed The merged values
|
* @return mixed The merged value
|
||||||
|
*
|
||||||
|
* @throws ForbiddenOverwriteException if the configuration path cannot be overwritten
|
||||||
|
* @throws InvalidTypeException if the value type is invalid
|
||||||
*/
|
*/
|
||||||
public function merge($leftSide, $rightSide);
|
public function merge($leftSide, $rightSide);
|
||||||
|
|
||||||
@ -83,6 +92,9 @@ interface NodeInterface
|
|||||||
* @param mixed $value The value to finalize
|
* @param mixed $value The value to finalize
|
||||||
*
|
*
|
||||||
* @return mixed The finalized value
|
* @return mixed The finalized value
|
||||||
|
*
|
||||||
|
* @throws InvalidTypeException if the value type is invalid
|
||||||
|
* @throws InvalidConfigurationException if the value is invalid configuration
|
||||||
*/
|
*/
|
||||||
public function finalize($value);
|
public function finalize($value);
|
||||||
}
|
}
|
||||||
|
@ -102,9 +102,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the node has a default value.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasDefaultValue()
|
public function hasDefaultValue()
|
||||||
{
|
{
|
||||||
@ -126,12 +124,10 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the default value.
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
* The default value could be either explicited or derived from the prototype
|
* The default value could be either explicited or derived from the prototype
|
||||||
* default value.
|
* default value.
|
||||||
*
|
|
||||||
* @return array The default value
|
|
||||||
*/
|
*/
|
||||||
public function getDefaultValue()
|
public function getDefaultValue()
|
||||||
{
|
{
|
||||||
|
@ -27,9 +27,6 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
|
|||||||
protected $defaultValue;
|
protected $defaultValue;
|
||||||
protected $allowEmptyValue = true;
|
protected $allowEmptyValue = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function setDefaultValue($value)
|
public function setDefaultValue($value)
|
||||||
{
|
{
|
||||||
$this->defaultValueSet = true;
|
$this->defaultValueSet = true;
|
||||||
|
Reference in New Issue
Block a user