mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 12:08:47 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -20,19 +20,26 @@ use Symfony\Component\Config\Definition\NodeInterface;
|
||||
*/
|
||||
class TreeBuilder implements NodeParentInterface
|
||||
{
|
||||
/**
|
||||
* @var NodeInterface|null
|
||||
*/
|
||||
protected $tree;
|
||||
|
||||
/**
|
||||
* @var NodeDefinition
|
||||
*/
|
||||
protected $root;
|
||||
|
||||
public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null)
|
||||
{
|
||||
$builder = $builder ?? new NodeBuilder();
|
||||
$builder ??= new NodeBuilder();
|
||||
$this->root = $builder->node($name, $type)->setParent($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NodeDefinition|ArrayNodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array')
|
||||
*/
|
||||
public function getRootNode(): NodeDefinition
|
||||
public function getRootNode(): NodeDefinition|ArrayNodeDefinition
|
||||
{
|
||||
return $this->root;
|
||||
}
|
||||
@@ -40,19 +47,16 @@ class TreeBuilder implements NodeParentInterface
|
||||
/**
|
||||
* Builds the tree.
|
||||
*
|
||||
* @return NodeInterface
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function buildTree()
|
||||
public function buildTree(): NodeInterface
|
||||
{
|
||||
if (null !== $this->tree) {
|
||||
return $this->tree;
|
||||
}
|
||||
|
||||
return $this->tree = $this->root->getNode(true);
|
||||
return $this->tree ??= $this->root->getNode(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setPathSeparator(string $separator)
|
||||
{
|
||||
// unset last built as changing path separator changes all nodes
|
||||
|
||||
Reference in New Issue
Block a user