This commit is contained in:
Paolo A
2024-08-13 13:44:16 +00:00
parent 1bbb23088d
commit e796d76612
4001 changed files with 30101 additions and 40075 deletions

View File

@@ -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);
}
@@ -53,7 +52,7 @@ 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);
@@ -71,12 +70,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;
}