mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Config\Definition\Builder;
|
||||
|
||||
use Symfony\Component\Config\Definition\BaseNode;
|
||||
use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;
|
||||
use Symfony\Component\Config\Definition\NodeInterface;
|
||||
|
||||
@@ -27,20 +28,17 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
protected $defaultValue;
|
||||
protected $default = false;
|
||||
protected $required = false;
|
||||
protected $deprecationMessage = null;
|
||||
protected $deprecation = [];
|
||||
protected $merge;
|
||||
protected $allowEmptyValue = true;
|
||||
protected $nullEquivalent;
|
||||
protected $trueEquivalent = true;
|
||||
protected $falseEquivalent = false;
|
||||
protected $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR;
|
||||
protected $parent;
|
||||
protected $attributes = [];
|
||||
|
||||
/**
|
||||
* @param string|null $name The name of the node
|
||||
* @param NodeParentInterface|null $parent The parent
|
||||
*/
|
||||
public function __construct($name, NodeParentInterface $parent = null)
|
||||
public function __construct(?string $name, NodeParentInterface $parent = null)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
$this->name = $name;
|
||||
@@ -61,11 +59,9 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Sets info message.
|
||||
*
|
||||
* @param string $info The info text
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function info($info)
|
||||
public function info(string $info)
|
||||
{
|
||||
return $this->attribute('info', $info);
|
||||
}
|
||||
@@ -85,12 +81,11 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Sets an attribute on the node.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function attribute($key, $value)
|
||||
public function attribute(string $key, $value)
|
||||
{
|
||||
$this->attributes[$key] = $value;
|
||||
|
||||
@@ -100,7 +95,7 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Returns the parent node.
|
||||
*
|
||||
* @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null The builder of the parent node
|
||||
* @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null
|
||||
*/
|
||||
public function end()
|
||||
{
|
||||
@@ -110,11 +105,9 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Creates the node.
|
||||
*
|
||||
* @param bool $forceRootNode Whether to force this node as the root node
|
||||
*
|
||||
* @return NodeInterface
|
||||
*/
|
||||
public function getNode($forceRootNode = false)
|
||||
public function getNode(bool $forceRootNode = false)
|
||||
{
|
||||
if ($forceRootNode) {
|
||||
$this->parent = null;
|
||||
@@ -129,7 +122,9 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
}
|
||||
|
||||
$node = $this->createNode();
|
||||
$node->setAttributes($this->attributes);
|
||||
if ($node instanceof BaseNode) {
|
||||
$node->setAttributes($this->attributes);
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
@@ -164,16 +159,35 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Sets the 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 $package The name of the composer package that is triggering the deprecation
|
||||
* @param string $version The version of the package that introduced the deprecation
|
||||
* @param string $message the deprecation message to use
|
||||
*
|
||||
* @param string $message Deprecation message
|
||||
* You can use %node% and %path% placeholders in your message to display,
|
||||
* respectively, the node name and its complete path
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDeprecated($message = 'The child node "%node%" at path "%path%" is deprecated.')
|
||||
public function setDeprecated(/* string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.' */)
|
||||
{
|
||||
$this->deprecationMessage = $message;
|
||||
$args = \func_get_args();
|
||||
|
||||
if (\func_num_args() < 2) {
|
||||
trigger_deprecation('symfony/config', '5.1', 'The signature of method "%s()" requires 3 arguments: "string $package, string $version, string $message", not defining them is deprecated.', __METHOD__);
|
||||
|
||||
$message = $args[0] ?? 'The child node "%node%" at path "%path%" is deprecated.';
|
||||
$package = $version = '';
|
||||
} else {
|
||||
$package = (string) $args[0];
|
||||
$version = (string) $args[1];
|
||||
$message = (string) ($args[2] ?? 'The child node "%node%" at path "%path%" is deprecated.');
|
||||
}
|
||||
|
||||
$this->deprecation = [
|
||||
'package' => $package,
|
||||
'version' => $version,
|
||||
'message' => $message,
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -289,11 +303,9 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Sets whether the node can be overwritten.
|
||||
*
|
||||
* @param bool $deny Whether the overwriting is forbidden or not
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function cannotBeOverwritten($deny = true)
|
||||
public function cannotBeOverwritten(bool $deny = true)
|
||||
{
|
||||
$this->merge()->denyOverwrite($deny);
|
||||
|
||||
@@ -345,9 +357,27 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
/**
|
||||
* Instantiate and configure the node according to this definition.
|
||||
*
|
||||
* @return NodeInterface The node instance
|
||||
* @return NodeInterface
|
||||
*
|
||||
* @throws InvalidDefinitionException When the definition is invalid
|
||||
*/
|
||||
abstract protected function createNode();
|
||||
|
||||
/**
|
||||
* Set PathSeparator to use.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPathSeparator(string $separator)
|
||||
{
|
||||
if ($this instanceof ParentNodeDefinitionInterface) {
|
||||
foreach ($this->getChildNodeDefinitions() as $child) {
|
||||
$child->setPathSeparator($separator);
|
||||
}
|
||||
}
|
||||
|
||||
$this->pathSeparator = $separator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user