Skip to content

Commit 982c655

Browse files
committed
Fix rector deprecations
1 parent c51552c commit 982c655

8 files changed

+25
-15
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
19+
php: [ '8.1', '8.2', '8.3', '8.4' ]
2020
os: [ ubuntu-latest, macos-latest, windows-latest ]
2121
stability: [ prefer-lowest, prefer-stable ]
2222
steps:

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": "^8.1",
2020
"ext-spl": "*",
21-
"phplrt/lexer": "^4.0"
21+
"phplrt/lexer": "^3.7"
2222
},
2323
"autoload": {
2424
"psr-4": {
@@ -38,8 +38,8 @@
3838
},
3939
"extra": {
4040
"branch-alias": {
41-
"dev-master": "4.x-dev",
42-
"dev-main": "4.x-dev"
41+
"dev-master": "3.x-dev",
42+
"dev-main": "3.x-dev"
4343
}
4444
},
4545
"config": {

src/ArrayBuffer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private function iterableToArray(iterable $tokens): array
4545
return $tokens;
4646
}
4747

48-
public function seek(mixed $offset): void
48+
public function seek($offset): void
4949
{
5050
if ($offset < $this->initial) {
5151
throw new \OutOfRangeException(

src/Buffer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function rewind(): void
5151
$this->seek($this->initial);
5252
}
5353

54-
public function seek(mixed $offset): void
54+
public function seek($offset): void
5555
{
5656
\assert($offset >= 0);
5757

src/BufferInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface BufferInterface extends \SeekableIterator
2020
*
2121
* @param int<0, max> $offset
2222
*/
23-
public function seek(mixed $offset): void;
23+
public function seek($offset): void;
2424

2525
/**
2626
* Return the current token.

src/ExtrusiveBuffer.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,23 @@ class ExtrusiveBuffer extends LazyBuffer
2020
*/
2121
public const BUFFER_DEFAULT_SIZE = 100;
2222

23+
/**
24+
* @var int<1, max>
25+
*/
26+
private int $size;
27+
2328
/**
2429
* @param iterable<TokenInterface> $stream
2530
* @param int<1, max> $size
2631
*/
2732
public function __construct(
2833
iterable $stream,
29-
private int $size = self::BUFFER_DEFAULT_SIZE
34+
int $size = self::BUFFER_DEFAULT_SIZE
3035
) {
36+
$this->size = $size;
37+
3138
/** @psalm-suppress RedundantCondition */
32-
assert($this->size > 0, 'Buffer size must be greater than 0, but ' . $this->size . ' passed');
39+
assert($this->size > 0, 'Buffer size must be greater than 0, but ' . $size . ' passed');
3340

3441
parent::__construct($stream);
3542
}
@@ -42,7 +49,7 @@ public function getBufferSize(): int
4249
return $this->size;
4350
}
4451

45-
public function seek(mixed $offset): void
52+
public function seek($offset): void
4653
{
4754
if ($offset < \array_key_first($this->buffer)) {
4855
$message = \sprintf(self::ERROR_BUFFER_MEMORY_ALREADY_FREED, $offset, $this->size);

src/LazyBuffer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getBufferCurrentSize(): int
5454
return \count($this->buffer);
5555
}
5656

57-
public function seek(mixed $offset): void
57+
public function seek($offset): void
5858
{
5959
if ($offset < $this->initial) {
6060
throw new \OutOfRangeException(

src/MutableBuffer.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@
1010
*/
1111
class MutableBuffer implements BufferInterface
1212
{
13+
private BufferInterface $parent;
14+
1315
/**
1416
* @var array<int<0, max>, TokenInterface>
1517
*/
1618
private array $overrides = [];
1719

18-
public function __construct(
19-
private BufferInterface $parent,
20-
) {}
20+
public function __construct(BufferInterface $parent)
21+
{
22+
$this->parent = $parent;
23+
}
2124

2225
/**
2326
* @param int<0, max> $offset
@@ -51,7 +54,7 @@ private function poll(int $offset): TokenInterface
5154
}
5255
}
5356

54-
public function seek(mixed $offset): void
57+
public function seek($offset): void
5558
{
5659
$this->parent->seek($offset);
5760
}

0 commit comments

Comments
 (0)