mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-11 17:33:56 +09:00
Updates to vendors etc
This commit is contained in:
@@ -29,13 +29,10 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class HashHandler implements HandlerInterface
|
||||
{
|
||||
private TokenizerPatterns $patterns;
|
||||
private TokenizerEscaping $escaping;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
$this->escaping = $escaping;
|
||||
public function __construct(
|
||||
private TokenizerPatterns $patterns,
|
||||
private TokenizerEscaping $escaping,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
|
||||
@@ -29,13 +29,10 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class IdentifierHandler implements HandlerInterface
|
||||
{
|
||||
private TokenizerPatterns $patterns;
|
||||
private TokenizerEscaping $escaping;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
$this->escaping = $escaping;
|
||||
public function __construct(
|
||||
private TokenizerPatterns $patterns,
|
||||
private TokenizerEscaping $escaping,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
|
||||
@@ -28,11 +28,9 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class NumberHandler implements HandlerInterface
|
||||
{
|
||||
private TokenizerPatterns $patterns;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
public function __construct(
|
||||
private TokenizerPatterns $patterns,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
|
||||
@@ -31,13 +31,10 @@ use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
*/
|
||||
class StringHandler implements HandlerInterface
|
||||
{
|
||||
private TokenizerPatterns $patterns;
|
||||
private TokenizerEscaping $escaping;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns, TokenizerEscaping $escaping)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
$this->escaping = $escaping;
|
||||
public function __construct(
|
||||
private TokenizerPatterns $patterns,
|
||||
private TokenizerEscaping $escaping,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(Reader $reader, TokenStream $stream): bool
|
||||
@@ -52,7 +49,7 @@ class StringHandler implements HandlerInterface
|
||||
$match = $reader->findPattern($this->patterns->getQuotedStringPattern($quote));
|
||||
|
||||
if (!$match) {
|
||||
throw new InternalErrorException(sprintf('Should have found at least an empty match at %d.', $reader->getPosition()));
|
||||
throw new InternalErrorException(\sprintf('Should have found at least an empty match at %d.', $reader->getPosition()));
|
||||
}
|
||||
|
||||
// check unclosed strings
|
||||
|
||||
44
vendor/symfony/css-selector/Parser/Parser.php
vendored
44
vendor/symfony/css-selector/Parser/Parser.php
vendored
@@ -87,13 +87,17 @@ class Parser implements ParserInterface
|
||||
];
|
||||
}
|
||||
|
||||
private function parseSelectorList(TokenStream $stream): array
|
||||
private function parseSelectorList(TokenStream $stream, bool $isArgument = false): array
|
||||
{
|
||||
$stream->skipWhitespace();
|
||||
$selectors = [];
|
||||
|
||||
while (true) {
|
||||
$selectors[] = $this->parserSelectorNode($stream);
|
||||
if ($isArgument && $stream->getPeek()->isDelimiter([')'])) {
|
||||
break;
|
||||
}
|
||||
|
||||
$selectors[] = $this->parserSelectorNode($stream, $isArgument);
|
||||
|
||||
if ($stream->getPeek()->isDelimiter([','])) {
|
||||
$stream->getNext();
|
||||
@@ -106,15 +110,19 @@ class Parser implements ParserInterface
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
private function parserSelectorNode(TokenStream $stream): Node\SelectorNode
|
||||
private function parserSelectorNode(TokenStream $stream, bool $isArgument = false): Node\SelectorNode
|
||||
{
|
||||
[$result, $pseudoElement] = $this->parseSimpleSelector($stream);
|
||||
[$result, $pseudoElement] = $this->parseSimpleSelector($stream, false, $isArgument);
|
||||
|
||||
while (true) {
|
||||
$stream->skipWhitespace();
|
||||
$peek = $stream->getPeek();
|
||||
|
||||
if ($peek->isFileEnd() || $peek->isDelimiter([','])) {
|
||||
if (
|
||||
$peek->isFileEnd()
|
||||
|| $peek->isDelimiter([','])
|
||||
|| ($isArgument && $peek->isDelimiter([')']))
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -129,7 +137,7 @@ class Parser implements ParserInterface
|
||||
$combinator = ' ';
|
||||
}
|
||||
|
||||
[$nextSelector, $pseudoElement] = $this->parseSimpleSelector($stream);
|
||||
[$nextSelector, $pseudoElement] = $this->parseSimpleSelector($stream, false, $isArgument);
|
||||
$result = new Node\CombinedSelectorNode($result, $combinator, $nextSelector);
|
||||
}
|
||||
|
||||
@@ -141,7 +149,7 @@ class Parser implements ParserInterface
|
||||
*
|
||||
* @throws SyntaxErrorException
|
||||
*/
|
||||
private function parseSimpleSelector(TokenStream $stream, bool $insideNegation = false): array
|
||||
private function parseSimpleSelector(TokenStream $stream, bool $insideNegation = false, bool $isArgument = false): array
|
||||
{
|
||||
$stream->skipWhitespace();
|
||||
|
||||
@@ -154,7 +162,7 @@ class Parser implements ParserInterface
|
||||
if ($peek->isWhitespace()
|
||||
|| $peek->isFileEnd()
|
||||
|| $peek->isDelimiter([',', '+', '>', '~'])
|
||||
|| ($insideNegation && $peek->isDelimiter([')']))
|
||||
|| ($isArgument && $peek->isDelimiter([')']))
|
||||
) {
|
||||
break;
|
||||
}
|
||||
@@ -215,7 +223,7 @@ class Parser implements ParserInterface
|
||||
throw SyntaxErrorException::nestedNot();
|
||||
}
|
||||
|
||||
[$argument, $argumentPseudoElement] = $this->parseSimpleSelector($stream, true);
|
||||
[$argument, $argumentPseudoElement] = $this->parseSimpleSelector($stream, true, true);
|
||||
$next = $stream->getNext();
|
||||
|
||||
if (null !== $argumentPseudoElement) {
|
||||
@@ -227,6 +235,24 @@ class Parser implements ParserInterface
|
||||
}
|
||||
|
||||
$result = new Node\NegationNode($result, $argument);
|
||||
} elseif ('is' === strtolower($identifier)) {
|
||||
$selectors = $this->parseSelectorList($stream, true);
|
||||
|
||||
$next = $stream->getNext();
|
||||
if (!$next->isDelimiter([')'])) {
|
||||
throw SyntaxErrorException::unexpectedToken('")"', $next);
|
||||
}
|
||||
|
||||
$result = new Node\MatchingNode($result, $selectors);
|
||||
} elseif ('where' === strtolower($identifier)) {
|
||||
$selectors = $this->parseSelectorList($stream, true);
|
||||
|
||||
$next = $stream->getNext();
|
||||
if (!$next->isDelimiter([')'])) {
|
||||
throw SyntaxErrorException::unexpectedToken('")"', $next);
|
||||
}
|
||||
|
||||
$result = new Node\SpecificityAdjustmentNode($result, $selectors);
|
||||
} else {
|
||||
$arguments = [];
|
||||
$next = null;
|
||||
|
||||
@@ -23,13 +23,12 @@ namespace Symfony\Component\CssSelector\Parser;
|
||||
*/
|
||||
class Reader
|
||||
{
|
||||
private string $source;
|
||||
private int $length;
|
||||
private int $position = 0;
|
||||
|
||||
public function __construct(string $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
public function __construct(
|
||||
private string $source,
|
||||
) {
|
||||
$this->length = \strlen($source);
|
||||
}
|
||||
|
||||
|
||||
20
vendor/symfony/css-selector/Parser/Token.php
vendored
20
vendor/symfony/css-selector/Parser/Token.php
vendored
@@ -31,15 +31,11 @@ class Token
|
||||
public const TYPE_NUMBER = 'number';
|
||||
public const TYPE_STRING = 'string';
|
||||
|
||||
private ?string $type;
|
||||
private ?string $value;
|
||||
private ?int $position;
|
||||
|
||||
public function __construct(?string $type, ?string $value, ?int $position)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->value = $value;
|
||||
$this->position = $position;
|
||||
public function __construct(
|
||||
private ?string $type,
|
||||
private ?string $value,
|
||||
private ?int $position,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getType(): ?int
|
||||
@@ -72,7 +68,7 @@ class Token
|
||||
return true;
|
||||
}
|
||||
|
||||
return \in_array($this->value, $values);
|
||||
return \in_array($this->value, $values, true);
|
||||
}
|
||||
|
||||
public function isWhitespace(): bool
|
||||
@@ -103,9 +99,9 @@ class Token
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->value) {
|
||||
return sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
|
||||
return \sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
|
||||
}
|
||||
|
||||
return sprintf('<%s at %s>', $this->type, $this->position);
|
||||
return \sprintf('<%s at %s>', $this->type, $this->position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,9 @@ namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
||||
*/
|
||||
class TokenizerEscaping
|
||||
{
|
||||
private TokenizerPatterns $patterns;
|
||||
|
||||
public function __construct(TokenizerPatterns $patterns)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
public function __construct(
|
||||
private TokenizerPatterns $patterns,
|
||||
) {
|
||||
}
|
||||
|
||||
public function escapeUnicode(string $value): string
|
||||
|
||||
@@ -84,6 +84,6 @@ class TokenizerPatterns
|
||||
|
||||
public function getQuotedStringPattern(string $quote): string
|
||||
{
|
||||
return '~^'.sprintf($this->quotedStringPattern, $quote).'~i';
|
||||
return '~^'.\sprintf($this->quotedStringPattern, $quote).'~i';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user