Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -23,28 +23,11 @@ namespace Symfony\Component\CssSelector\XPath;
*/
class XPathExpr
{
/**
* @var string
*/
private $path;
private string $path;
private string $element;
private string $condition;
/**
* @var string
*/
private $element;
/**
* @var string
*/
private $condition;
/**
* @param string $path
* @param string $element
* @param string $condition
* @param bool $starPrefix
*/
public function __construct($path = '', $element = '*', $condition = '', $starPrefix = false)
public function __construct(string $path = '', string $element = '*', string $condition = '', bool $starPrefix = false)
{
$this->path = $path;
$this->element = $element;
@@ -55,30 +38,22 @@ class XPathExpr
}
}
/**
* @return string
*/
public function getElement()
public function getElement(): string
{
return $this->element;
}
/**
* @param $condition
*
* @return $this
*/
public function addCondition($condition)
public function addCondition(string $condition): static
{
$this->condition = $this->condition ? sprintf('%s and (%s)', $this->condition, $condition) : $condition;
$this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition;
return $this;
}
/**
* @return string
*/
public function getCondition()
public function getCondition(): string
{
return $this->condition;
}
@@ -86,7 +61,7 @@ class XPathExpr
/**
* @return $this
*/
public function addNameTest()
public function addNameTest(): static
{
if ('*' !== $this->element) {
$this->addCondition('name() = '.Translator::getXpathLiteral($this->element));
@@ -99,7 +74,7 @@ class XPathExpr
/**
* @return $this
*/
public function addStarPrefix()
public function addStarPrefix(): static
{
$this->path .= '*/';
@@ -109,12 +84,9 @@ class XPathExpr
/**
* Joins another XPathExpr with a combiner.
*
* @param string $combiner
* @param XPathExpr $expr
*
* @return $this
*/
public function join($combiner, XPathExpr $expr)
public function join(string $combiner, self $expr): static
{
$path = $this->__toString().$combiner;
@@ -129,10 +101,7 @@ class XPathExpr
return $this;
}
/**
* @return string
*/
public function __toString()
public function __toString(): string
{
$path = $this->path.$this->element;
$condition = null === $this->condition || '' === $this->condition ? '' : '['.$this->condition.']';