laravel-6 support
This commit is contained in:
91
vendor/symfony/css-selector/Parser/Token.php
vendored
91
vendor/symfony/css-selector/Parser/Token.php
vendored
@@ -23,79 +23,46 @@ namespace Symfony\Component\CssSelector\Parser;
|
||||
*/
|
||||
class Token
|
||||
{
|
||||
const TYPE_FILE_END = 'eof';
|
||||
const TYPE_DELIMITER = 'delimiter';
|
||||
const TYPE_WHITESPACE = 'whitespace';
|
||||
const TYPE_IDENTIFIER = 'identifier';
|
||||
const TYPE_HASH = 'hash';
|
||||
const TYPE_NUMBER = 'number';
|
||||
const TYPE_STRING = 'string';
|
||||
public const TYPE_FILE_END = 'eof';
|
||||
public const TYPE_DELIMITER = 'delimiter';
|
||||
public const TYPE_WHITESPACE = 'whitespace';
|
||||
public const TYPE_IDENTIFIER = 'identifier';
|
||||
public const TYPE_HASH = 'hash';
|
||||
public const TYPE_NUMBER = 'number';
|
||||
public const TYPE_STRING = 'string';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $position;
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
* @param string $value
|
||||
* @param int $position
|
||||
*/
|
||||
public function __construct($type, $value, $position)
|
||||
public function __construct(?string $type, ?string $value, ?int $position)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->value = $value;
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getType()
|
||||
public function getType(): ?int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
public function getValue(): ?string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPosition()
|
||||
public function getPosition(): ?int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isFileEnd()
|
||||
public function isFileEnd(): bool
|
||||
{
|
||||
return self::TYPE_FILE_END === $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $values
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDelimiter(array $values = array())
|
||||
public function isDelimiter(array $values = []): bool
|
||||
{
|
||||
if (self::TYPE_DELIMITER !== $this->type) {
|
||||
return false;
|
||||
@@ -105,53 +72,35 @@ class Token
|
||||
return true;
|
||||
}
|
||||
|
||||
return in_array($this->value, $values);
|
||||
return \in_array($this->value, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isWhitespace()
|
||||
public function isWhitespace(): bool
|
||||
{
|
||||
return self::TYPE_WHITESPACE === $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isIdentifier()
|
||||
public function isIdentifier(): bool
|
||||
{
|
||||
return self::TYPE_IDENTIFIER === $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isHash()
|
||||
public function isHash(): bool
|
||||
{
|
||||
return self::TYPE_HASH === $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNumber()
|
||||
public function isNumber(): bool
|
||||
{
|
||||
return self::TYPE_NUMBER === $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isString()
|
||||
public function isString(): bool
|
||||
{
|
||||
return self::TYPE_STRING === $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->value) {
|
||||
return sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
|
||||
|
Reference in New Issue
Block a user