package and depencies
This commit is contained in:
28
vendor/symfony/css-selector/XPath/Translator.php
vendored
28
vendor/symfony/css-selector/XPath/Translator.php
vendored
@@ -30,23 +30,23 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
||||
*/
|
||||
class Translator implements TranslatorInterface
|
||||
{
|
||||
private $mainParser;
|
||||
private ParserInterface $mainParser;
|
||||
|
||||
/**
|
||||
* @var ParserInterface[]
|
||||
*/
|
||||
private $shortcutParsers = [];
|
||||
private array $shortcutParsers = [];
|
||||
|
||||
/**
|
||||
* @var Extension\ExtensionInterface[]
|
||||
*/
|
||||
private $extensions = [];
|
||||
private array $extensions = [];
|
||||
|
||||
private $nodeTranslators = [];
|
||||
private $combinationTranslators = [];
|
||||
private $functionTranslators = [];
|
||||
private $pseudoClassTranslators = [];
|
||||
private $attributeMatchingTranslators = [];
|
||||
private array $nodeTranslators = [];
|
||||
private array $combinationTranslators = [];
|
||||
private array $functionTranslators = [];
|
||||
private array $pseudoClassTranslators = [];
|
||||
private array $attributeMatchingTranslators = [];
|
||||
|
||||
public function __construct(ParserInterface $parser = null)
|
||||
{
|
||||
@@ -87,9 +87,6 @@ class Translator implements TranslatorInterface
|
||||
return sprintf('concat(%s)', implode(', ', $parts));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
|
||||
{
|
||||
$selectors = $this->parseSelectors($cssExpr);
|
||||
@@ -106,9 +103,6 @@ class Translator implements TranslatorInterface
|
||||
return implode(' | ', $selectors);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::'): string
|
||||
{
|
||||
return ($prefix ?: '').$this->nodeToXPath($selector);
|
||||
@@ -117,7 +111,7 @@ class Translator implements TranslatorInterface
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function registerExtension(Extension\ExtensionInterface $extension): self
|
||||
public function registerExtension(Extension\ExtensionInterface $extension): static
|
||||
{
|
||||
$this->extensions[$extension->getName()] = $extension;
|
||||
|
||||
@@ -145,7 +139,7 @@ class Translator implements TranslatorInterface
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function registerParserShortcut(ParserInterface $shortcut): self
|
||||
public function registerParserShortcut(ParserInterface $shortcut): static
|
||||
{
|
||||
$this->shortcutParsers[] = $shortcut;
|
||||
|
||||
@@ -220,7 +214,7 @@ class Translator implements TranslatorInterface
|
||||
foreach ($this->shortcutParsers as $shortcut) {
|
||||
$tokens = $shortcut->parse($css);
|
||||
|
||||
if (!empty($tokens)) {
|
||||
if ($tokens) {
|
||||
return $tokens;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user