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:
bdalsass
2023-12-05 13:56:56 +01:00
committed by GitHub
parent 863ab4560c
commit 27ce51ab07
1392 changed files with 44869 additions and 27799 deletions

View File

@@ -23,17 +23,10 @@ namespace Symfony\Component\CssSelector\Node;
*/
abstract class AbstractNode implements NodeInterface
{
/**
* @var string
*/
private $nodeName;
private string $nodeName;
public function getNodeName(): string
{
if (null === $this->nodeName) {
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
}
return $this->nodeName;
return $this->nodeName ??= preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
}
}

View File

@@ -23,11 +23,11 @@ namespace Symfony\Component\CssSelector\Node;
*/
class AttributeNode extends AbstractNode
{
private $selector;
private $namespace;
private $attribute;
private $operator;
private $value;
private NodeInterface $selector;
private ?string $namespace;
private string $attribute;
private string $operator;
private ?string $value;
public function __construct(NodeInterface $selector, ?string $namespace, string $attribute, string $operator, ?string $value)
{
@@ -63,9 +63,6 @@ class AttributeNode extends AbstractNode
return $this->value;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));

View File

@@ -23,8 +23,8 @@ namespace Symfony\Component\CssSelector\Node;
*/
class ClassNode extends AbstractNode
{
private $selector;
private $name;
private NodeInterface $selector;
private string $name;
public function __construct(NodeInterface $selector, string $name)
{
@@ -42,9 +42,6 @@ class ClassNode extends AbstractNode
return $this->name;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));

View File

@@ -23,9 +23,9 @@ namespace Symfony\Component\CssSelector\Node;
*/
class CombinedSelectorNode extends AbstractNode
{
private $selector;
private $combinator;
private $subSelector;
private NodeInterface $selector;
private string $combinator;
private NodeInterface $subSelector;
public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector)
{
@@ -49,9 +49,6 @@ class CombinedSelectorNode extends AbstractNode
return $this->subSelector;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());

View File

@@ -23,8 +23,8 @@ namespace Symfony\Component\CssSelector\Node;
*/
class ElementNode extends AbstractNode
{
private $namespace;
private $element;
private ?string $namespace;
private ?string $element;
public function __construct(string $namespace = null, string $element = null)
{
@@ -42,9 +42,6 @@ class ElementNode extends AbstractNode
return $this->element;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return new Specificity(0, 0, $this->element ? 1 : 0);

View File

@@ -25,9 +25,9 @@ use Symfony\Component\CssSelector\Parser\Token;
*/
class FunctionNode extends AbstractNode
{
private $selector;
private $name;
private $arguments;
private NodeInterface $selector;
private string $name;
private array $arguments;
/**
* @param Token[] $arguments
@@ -57,9 +57,6 @@ class FunctionNode extends AbstractNode
return $this->arguments;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
@@ -67,9 +64,7 @@ class FunctionNode extends AbstractNode
public function __toString(): string
{
$arguments = implode(', ', array_map(function (Token $token) {
return "'".$token->getValue()."'";
}, $this->arguments));
$arguments = implode(', ', array_map(fn (Token $token) => "'".$token->getValue()."'", $this->arguments));
return sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '['.$arguments.']' : '');
}

View File

@@ -23,8 +23,8 @@ namespace Symfony\Component\CssSelector\Node;
*/
class HashNode extends AbstractNode
{
private $selector;
private $id;
private NodeInterface $selector;
private string $id;
public function __construct(NodeInterface $selector, string $id)
{
@@ -42,9 +42,6 @@ class HashNode extends AbstractNode
return $this->id;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(1, 0, 0));

View File

@@ -23,8 +23,8 @@ namespace Symfony\Component\CssSelector\Node;
*/
class NegationNode extends AbstractNode
{
private $selector;
private $subSelector;
private NodeInterface $selector;
private NodeInterface $subSelector;
public function __construct(NodeInterface $selector, NodeInterface $subSelector)
{
@@ -42,9 +42,6 @@ class NegationNode extends AbstractNode
return $this->subSelector;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());

View File

@@ -21,11 +21,9 @@ namespace Symfony\Component\CssSelector\Node;
*
* @internal
*/
interface NodeInterface
interface NodeInterface extends \Stringable
{
public function getNodeName(): string;
public function getSpecificity(): Specificity;
public function __toString(): string;
}

View File

@@ -23,8 +23,8 @@ namespace Symfony\Component\CssSelector\Node;
*/
class PseudoNode extends AbstractNode
{
private $selector;
private $identifier;
private NodeInterface $selector;
private string $identifier;
public function __construct(NodeInterface $selector, string $identifier)
{
@@ -42,9 +42,6 @@ class PseudoNode extends AbstractNode
return $this->identifier;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));

View File

@@ -23,8 +23,8 @@ namespace Symfony\Component\CssSelector\Node;
*/
class SelectorNode extends AbstractNode
{
private $tree;
private $pseudoElement;
private NodeInterface $tree;
private ?string $pseudoElement;
public function __construct(NodeInterface $tree, string $pseudoElement = null)
{
@@ -42,9 +42,6 @@ class SelectorNode extends AbstractNode
return $this->pseudoElement;
}
/**
* {@inheritdoc}
*/
public function getSpecificity(): Specificity
{
return $this->tree->getSpecificity()->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0));

View File

@@ -29,9 +29,9 @@ class Specificity
public const B_FACTOR = 10;
public const C_FACTOR = 1;
private $a;
private $b;
private $c;
private int $a;
private int $b;
private int $c;
public function __construct(int $a, int $b, int $c)
{