mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-11 17:33:56 +09:00
Update dependencies
This commit is contained in:
@@ -26,9 +26,6 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class CommentHandler implements HandlerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
{
|
||||
if ('/*' !== $reader->getSubstring(2)) {
|
||||
|
||||
@@ -29,8 +29,8 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class HashHandler implements HandlerInterface
|
||||
{
|
||||
private $patterns;
|
||||
private $escaping;
|
||||
private TokenizerPatterns $patterns;
|
||||
private TokenizerEscaping $escaping;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping)
|
||||
{
|
||||
@@ -38,9 +38,6 @@ class HashHandler implements HandlerInterface
|
||||
$this->escaping = $escaping;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
{
|
||||
$match = $reader->findPattern($this->patterns->getHashPattern());
|
||||
|
||||
@@ -29,8 +29,8 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class IdentifierHandler implements HandlerInterface
|
||||
{
|
||||
private $patterns;
|
||||
private $escaping;
|
||||
private TokenizerPatterns $patterns;
|
||||
private TokenizerEscaping $escaping;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping)
|
||||
{
|
||||
@@ -38,9 +38,6 @@ class IdentifierHandler implements HandlerInterface
|
||||
$this->escaping = $escaping;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
{
|
||||
$match = $reader->findPattern($this->patterns->getIdentifierPattern());
|
||||
|
||||
@@ -28,16 +28,13 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class NumberHandler implements HandlerInterface
|
||||
{
|
||||
private $patterns;
|
||||
private TokenizerPatterns $patterns;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
{
|
||||
$match = $reader->findPattern($this->patterns->getNumberPattern());
|
||||
|
||||
@@ -31,8 +31,8 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class StringHandler implements HandlerInterface
|
||||
{
|
||||
private $patterns;
|
||||
private $escaping;
|
||||
private TokenizerPatterns $patterns;
|
||||
private TokenizerEscaping $escaping;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping)
|
||||
{
|
||||
@@ -40,9 +40,6 @@ class StringHandler implements HandlerInterface
|
||||
$this->escaping = $escaping;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
{
|
||||
$quote = $reader->getSubstring(1);
|
||||
|
||||
@@ -27,9 +27,6 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class WhitespaceHandler implements HandlerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
{
|
||||
$match = $reader->findPattern('~^[ \t\r\n\f]+~');
|
||||
|
||||
28
vendor/symfony/css-selector/Parser/Parser.php
vendored
28
vendor/symfony/css-selector/Parser/Parser.php
vendored
@@ -19,7 +19,7 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer;
|
||||
* CSS selector parser.
|
||||
*
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
* which is copyright Ian Bicking, @see https://github.com/scrapy/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
*
|
||||
@@ -27,16 +27,13 @@ use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer;
|
||||
*/
|
||||
class Parser implements ParserInterface
|
||||
{
|
||||
private $tokenizer;
|
||||
private Tokenizer $tokenizer;
|
||||
|
||||
public function __construct(Tokenizer $tokenizer = null)
|
||||
public function __construct(?Tokenizer $tokenizer = null)
|
||||
{
|
||||
$this->tokenizer = $tokenizer ?? new Tokenizer();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parse(string $source): array
|
||||
{
|
||||
$reader = new Reader($source);
|
||||
@@ -60,9 +57,7 @@ class Parser implements ParserInterface
|
||||
}
|
||||
}
|
||||
|
||||
$joined = trim(implode('', array_map(function (Token $token) {
|
||||
return $token->getValue();
|
||||
}, $tokens)));
|
||||
$joined = trim(implode('', array_map(fn (Token $token) => $token->getValue(), $tokens)));
|
||||
|
||||
$int = function ($string) {
|
||||
if (!is_numeric($string)) {
|
||||
@@ -197,7 +192,18 @@ class Parser implements ParserInterface
|
||||
|
||||
if (!$stream->getPeek()->isDelimiter(['('])) {
|
||||
$result = new Node\PseudoNode($result, $identifier);
|
||||
|
||||
if ('Pseudo[Element[*]:scope]' === $result->__toString()) {
|
||||
$used = \count($stream->getUsed());
|
||||
if (!(2 === $used
|
||||
|| 3 === $used && $stream->getUsed()[0]->isWhiteSpace()
|
||||
|| $used >= 3 && $stream->getUsed()[$used - 3]->isDelimiter([','])
|
||||
|| $used >= 4
|
||||
&& $stream->getUsed()[$used - 3]->isWhiteSpace()
|
||||
&& $stream->getUsed()[$used - 4]->isDelimiter([','])
|
||||
)) {
|
||||
throw SyntaxErrorException::notAtTheStartOfASelector('scope');
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -242,7 +248,7 @@ class Parser implements ParserInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($arguments)) {
|
||||
if (!$arguments) {
|
||||
throw SyntaxErrorException::unexpectedToken('at least one argument', $next);
|
||||
}
|
||||
|
||||
|
||||
17
vendor/symfony/css-selector/Parser/Reader.php
vendored
17
vendor/symfony/css-selector/Parser/Reader.php
vendored
@@ -23,9 +23,9 @@ namespace Symfony\Component\CssSelector\Parser;
|
||||
*/
|
||||
class Reader
|
||||
{
|
||||
private $source;
|
||||
private $length;
|
||||
private $position = 0;
|
||||
private string $source;
|
||||
private int $length;
|
||||
private int $position = 0;
|
||||
|
||||
public function __construct(string $source)
|
||||
{
|
||||
@@ -53,17 +53,14 @@ class Reader
|
||||
return substr($this->source, $this->position + $offset, $length);
|
||||
}
|
||||
|
||||
public function getOffset(string $string)
|
||||
public function getOffset(string $string): int|false
|
||||
{
|
||||
$position = strpos($this->source, $string, $this->position);
|
||||
|
||||
return false === $position ? false : $position - $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|false
|
||||
*/
|
||||
public function findPattern(string $pattern)
|
||||
public function findPattern(string $pattern): array|false
|
||||
{
|
||||
$source = substr($this->source, $this->position);
|
||||
|
||||
@@ -74,12 +71,12 @@ class Reader
|
||||
return false;
|
||||
}
|
||||
|
||||
public function moveForward(int $length)
|
||||
public function moveForward(int $length): void
|
||||
{
|
||||
$this->position += $length;
|
||||
}
|
||||
|
||||
public function moveToEnd()
|
||||
public function moveToEnd(): void
|
||||
{
|
||||
$this->position = $this->length;
|
||||
}
|
||||
|
||||
@@ -28,9 +28,6 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
||||
*/
|
||||
class ClassParser implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parse(string $source): array
|
||||
{
|
||||
// Matches an optional namespace, optional element, and required class
|
||||
|
||||
@@ -27,9 +27,6 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
||||
*/
|
||||
class ElementParser implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parse(string $source): array
|
||||
{
|
||||
// Matches an optional namespace, required element or `*`
|
||||
|
||||
@@ -31,9 +31,6 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
||||
*/
|
||||
class EmptyStringParser implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parse(string $source): array
|
||||
{
|
||||
// Matches an empty string
|
||||
|
||||
@@ -28,9 +28,6 @@ use Symfony\Component\CssSelector\Parser\ParserInterface;
|
||||
*/
|
||||
class HashParser implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parse(string $source): array
|
||||
{
|
||||
// Matches an optional namespace, optional element, and required id
|
||||
|
||||
8
vendor/symfony/css-selector/Parser/Token.php
vendored
8
vendor/symfony/css-selector/Parser/Token.php
vendored
@@ -31,9 +31,9 @@ class Token
|
||||
public const TYPE_NUMBER = 'number';
|
||||
public const TYPE_STRING = 'string';
|
||||
|
||||
private $type;
|
||||
private $value;
|
||||
private $position;
|
||||
private ?string $type;
|
||||
private ?string $value;
|
||||
private ?int $position;
|
||||
|
||||
public function __construct(?string $type, ?string $value, ?int $position)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ class Token
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($values)) {
|
||||
if (!$values) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,34 +29,23 @@ class TokenStream
|
||||
/**
|
||||
* @var Token[]
|
||||
*/
|
||||
private $tokens = [];
|
||||
private array $tokens = [];
|
||||
|
||||
/**
|
||||
* @var Token[]
|
||||
*/
|
||||
private $used = [];
|
||||
private array $used = [];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $cursor = 0;
|
||||
|
||||
/**
|
||||
* @var Token|null
|
||||
*/
|
||||
private $peeked;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $peeking = false;
|
||||
private int $cursor = 0;
|
||||
private ?Token $peeked;
|
||||
private bool $peeking = false;
|
||||
|
||||
/**
|
||||
* Pushes a token.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function push(Token $token): self
|
||||
public function push(Token $token): static
|
||||
{
|
||||
$this->tokens[] = $token;
|
||||
|
||||
@@ -68,7 +57,7 @@ class TokenStream
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function freeze(): self
|
||||
public function freeze(): static
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
@@ -156,7 +145,7 @@ class TokenStream
|
||||
/**
|
||||
* Skips next whitespace if any.
|
||||
*/
|
||||
public function skipWhitespace()
|
||||
public function skipWhitespace(): void
|
||||
{
|
||||
$peek = $this->getPeek();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class Tokenizer
|
||||
/**
|
||||
* @var Handler\HandlerInterface[]
|
||||
*/
|
||||
private $handlers;
|
||||
private array $handlers;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
||||
*/
|
||||
class TokenizerEscaping
|
||||
{
|
||||
private $patterns;
|
||||
private TokenizerPatterns $patterns;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns)
|
||||
{
|
||||
|
||||
@@ -23,18 +23,18 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
||||
*/
|
||||
class TokenizerPatterns
|
||||
{
|
||||
private $unicodeEscapePattern;
|
||||
private $simpleEscapePattern;
|
||||
private $newLineEscapePattern;
|
||||
private $escapePattern;
|
||||
private $stringEscapePattern;
|
||||
private $nonAsciiPattern;
|
||||
private $nmCharPattern;
|
||||
private $nmStartPattern;
|
||||
private $identifierPattern;
|
||||
private $hashPattern;
|
||||
private $numberPattern;
|
||||
private $quotedStringPattern;
|
||||
private string $unicodeEscapePattern;
|
||||
private string $simpleEscapePattern;
|
||||
private string $newLineEscapePattern;
|
||||
private string $escapePattern;
|
||||
private string $stringEscapePattern;
|
||||
private string $nonAsciiPattern;
|
||||
private string $nmCharPattern;
|
||||
private string $nmStartPattern;
|
||||
private string $identifierPattern;
|
||||
private string $hashPattern;
|
||||
private string $numberPattern;
|
||||
private string $quotedStringPattern;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -49,22 +49,22 @@ class TokenizerPatterns
|
||||
$this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
|
||||
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
|
||||
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';
|
||||
$this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*';
|
||||
$this->quotedStringPattern = '([^\n\r\f\\\\%s]|'.$this->stringEscapePattern.')*';
|
||||
}
|
||||
|
||||
public function getNewLineEscapePattern(): string
|
||||
{
|
||||
return '~^'.$this->newLineEscapePattern.'~';
|
||||
return '~'.$this->newLineEscapePattern.'~';
|
||||
}
|
||||
|
||||
public function getSimpleEscapePattern(): string
|
||||
{
|
||||
return '~^'.$this->simpleEscapePattern.'~';
|
||||
return '~'.$this->simpleEscapePattern.'~';
|
||||
}
|
||||
|
||||
public function getUnicodeEscapePattern(): string
|
||||
{
|
||||
return '~^'.$this->unicodeEscapePattern.'~i';
|
||||
return '~'.$this->unicodeEscapePattern.'~i';
|
||||
}
|
||||
|
||||
public function getIdentifierPattern(): string
|
||||
|
||||
Reference in New Issue
Block a user