mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 14:58:43 +02:00
N°8834 - Add compatibility with PHP 8.4 (#819)
* N°8834 - Add compatibility with PHP 8.4 * Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
@@ -37,7 +37,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
protected $nodeBuilder;
|
||||
protected $normalizeKeys = true;
|
||||
|
||||
public function __construct(?string $name, NodeParentInterface $parent = null)
|
||||
public function __construct(?string $name, ?NodeParentInterface $parent = null)
|
||||
{
|
||||
parent::__construct($name, $parent);
|
||||
|
||||
@@ -126,7 +126,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addDefaultChildrenIfNoneSet(int|string|array $children = null): static
|
||||
public function addDefaultChildrenIfNoneSet(int|string|array|null $children = null): static
|
||||
{
|
||||
$this->addDefaultChildren = $children;
|
||||
|
||||
@@ -169,7 +169,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fixXmlConfig(string $singular, string $plural = null): static
|
||||
public function fixXmlConfig(string $singular, ?string $plural = null): static
|
||||
{
|
||||
$this->normalization()->remap($singular, $plural);
|
||||
|
||||
@@ -331,7 +331,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
|
||||
public function append(NodeDefinition $node): static
|
||||
{
|
||||
$this->children[$node->name] = $node->setParent($this);
|
||||
$this->children[$node->name ?? ''] = $node->setParent($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
|
||||
if ($this->default) {
|
||||
if (!\is_array($this->defaultValue)) {
|
||||
throw new \InvalidArgumentException(sprintf('%s: the default value of an array node has to be an array.', $node->getPath()));
|
||||
throw new \InvalidArgumentException(\sprintf('%s: the default value of an array node has to be an array.', $node->getPath()));
|
||||
}
|
||||
|
||||
$node->setDefaultValue($this->defaultValue);
|
||||
@@ -434,23 +434,23 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
$path = $node->getPath();
|
||||
|
||||
if (null !== $this->key) {
|
||||
throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path));
|
||||
}
|
||||
|
||||
if (false === $this->allowEmptyValue) {
|
||||
throw new InvalidDefinitionException(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s".', $path));
|
||||
}
|
||||
|
||||
if (true === $this->atLeastOne) {
|
||||
throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path));
|
||||
}
|
||||
|
||||
if ($this->default) {
|
||||
throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path));
|
||||
}
|
||||
|
||||
if (false !== $this->addDefaultChildren) {
|
||||
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,20 +466,20 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
$path = $node->getPath();
|
||||
|
||||
if ($this->addDefaults) {
|
||||
throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path));
|
||||
}
|
||||
|
||||
if (false !== $this->addDefaultChildren) {
|
||||
if ($this->default) {
|
||||
throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('A default value and default children might not be used together at path "%s".', $path));
|
||||
}
|
||||
|
||||
if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
|
||||
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path));
|
||||
}
|
||||
|
||||
if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) {
|
||||
throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path));
|
||||
throw new InvalidDefinitionException(\sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,7 +504,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
: substr($nodePath, 0, $pathSeparatorPos);
|
||||
|
||||
if (null === $node = ($this->children[$firstPathSegment] ?? null)) {
|
||||
throw new \RuntimeException(sprintf('Node with name "%s" does not exist in the current node "%s".', $firstPathSegment, $this->name));
|
||||
throw new \RuntimeException(\sprintf('Node with name "%s" does not exist in the current node "%s".', $firstPathSegment, $this->name));
|
||||
}
|
||||
|
||||
if (false === $pathSeparatorPos) {
|
||||
|
||||
Reference in New Issue
Block a user