laravel-6 support
This commit is contained in:
59
vendor/symfony/css-selector/Parser/Reader.php
vendored
59
vendor/symfony/css-selector/Parser/Reader.php
vendored
@@ -23,71 +23,37 @@ namespace Symfony\Component\CssSelector\Parser;
|
||||
*/
|
||||
class Reader
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $length;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $position = 0;
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
*/
|
||||
public function __construct($source)
|
||||
public function __construct(string $source)
|
||||
{
|
||||
$this->source = $source;
|
||||
$this->length = strlen($source);
|
||||
$this->length = \strlen($source);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEOF()
|
||||
public function isEOF(): bool
|
||||
{
|
||||
return $this->position >= $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPosition()
|
||||
public function getPosition(): int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRemainingLength()
|
||||
public function getRemainingLength(): int
|
||||
{
|
||||
return $this->length - $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $length
|
||||
* @param int $offset
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubstring($length, $offset = 0)
|
||||
public function getSubstring(int $length, int $offset = 0): string
|
||||
{
|
||||
return substr($this->source, $this->position + $offset, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOffset($string)
|
||||
public function getOffset(string $string)
|
||||
{
|
||||
$position = strpos($this->source, $string, $this->position);
|
||||
|
||||
@@ -95,11 +61,9 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pattern
|
||||
*
|
||||
* @return bool
|
||||
* @return array|false
|
||||
*/
|
||||
public function findPattern($pattern)
|
||||
public function findPattern(string $pattern)
|
||||
{
|
||||
$source = substr($this->source, $this->position);
|
||||
|
||||
@@ -110,10 +74,7 @@ class Reader
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $length
|
||||
*/
|
||||
public function moveForward($length)
|
||||
public function moveForward(int $length)
|
||||
{
|
||||
$this->position += $length;
|
||||
}
|
||||
|
Reference in New Issue
Block a user