Augmentation vers version 3.3.0
This commit is contained in:
74
vendor/symfony/config/Definition/BaseNode.php
vendored
74
vendor/symfony/config/Definition/BaseNode.php
vendored
@@ -25,12 +25,13 @@ abstract class BaseNode implements NodeInterface
|
||||
{
|
||||
protected $name;
|
||||
protected $parent;
|
||||
protected $normalizationClosures = array();
|
||||
protected $finalValidationClosures = array();
|
||||
protected $normalizationClosures = [];
|
||||
protected $finalValidationClosures = [];
|
||||
protected $allowOverwrite = true;
|
||||
protected $required = false;
|
||||
protected $equivalentValues = array();
|
||||
protected $attributes = array();
|
||||
protected $deprecationMessage = null;
|
||||
protected $equivalentValues = [];
|
||||
protected $attributes = [];
|
||||
|
||||
/**
|
||||
* @param string|null $name The name of the node
|
||||
@@ -48,21 +49,37 @@ abstract class BaseNode implements NodeInterface
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*/
|
||||
public function setAttribute($key, $value)
|
||||
{
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute($key, $default = null)
|
||||
{
|
||||
return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAttribute($key)
|
||||
{
|
||||
return isset($this->attributes[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
return $this->attributes;
|
||||
@@ -73,6 +90,9 @@ abstract class BaseNode implements NodeInterface
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*/
|
||||
public function removeAttribute($key)
|
||||
{
|
||||
unset($this->attributes[$key]);
|
||||
@@ -91,7 +111,7 @@ abstract class BaseNode implements NodeInterface
|
||||
/**
|
||||
* Returns info message.
|
||||
*
|
||||
* @return string The info text
|
||||
* @return string|null The info text
|
||||
*/
|
||||
public function getInfo()
|
||||
{
|
||||
@@ -111,7 +131,7 @@ abstract class BaseNode implements NodeInterface
|
||||
/**
|
||||
* Retrieves the example configuration for this node.
|
||||
*
|
||||
* @return string|array The example
|
||||
* @return string|array|null The example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
@@ -126,7 +146,7 @@ abstract class BaseNode implements NodeInterface
|
||||
*/
|
||||
public function addEquivalentValue($originalValue, $equivalentValue)
|
||||
{
|
||||
$this->equivalentValues[] = array($originalValue, $equivalentValue);
|
||||
$this->equivalentValues[] = [$originalValue, $equivalentValue];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,6 +159,19 @@ abstract class BaseNode implements NodeInterface
|
||||
$this->required = (bool) $boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this node as deprecated.
|
||||
*
|
||||
* You can use %node% and %path% placeholders in your message to display,
|
||||
* respectively, the node name and its complete path.
|
||||
*
|
||||
* @param string|null $message Deprecated message
|
||||
*/
|
||||
public function setDeprecated($message)
|
||||
{
|
||||
$this->deprecationMessage = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if this node can be overridden.
|
||||
*
|
||||
@@ -177,6 +210,29 @@ abstract class BaseNode implements NodeInterface
|
||||
return $this->required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this node is deprecated.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDeprecated()
|
||||
{
|
||||
return null !== $this->deprecationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the deprecated message.
|
||||
*
|
||||
* @param string $node the configuration node name
|
||||
* @param string $path the path of the node
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDeprecationMessage($node, $path)
|
||||
{
|
||||
return strtr($this->deprecationMessage, ['%node%' => $node, '%path%' => $path]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -243,9 +299,9 @@ abstract class BaseNode implements NodeInterface
|
||||
/**
|
||||
* Normalizes the value before any other normalization is applied.
|
||||
*
|
||||
* @param $value
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return The normalized array value
|
||||
* @return mixed The normalized array value
|
||||
*/
|
||||
protected function preNormalize($value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user