Skip to content

Commit 94ba992

Browse files
committed
Fix rector deprecations
1 parent aed8a99 commit 94ba992

File tree

6 files changed

+29
-25
lines changed

6 files changed

+29
-25
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"ext-pcre": "*",
2222
"ext-json": "*",
2323
"ext-mbstring": "*",
24-
"phplrt/source": "^4.0",
25-
"phplrt/position": "^4.0",
26-
"phplrt/exception-contracts": "^4.0"
24+
"phplrt/source": "^3.7",
25+
"phplrt/position": "^3.7",
26+
"phplrt/exception-contracts": "^3.7"
2727
},
2828
"autoload": {
2929
"psr-4": {
@@ -42,12 +42,12 @@
4242
}
4343
},
4444
"provide": {
45-
"phplrt/exception-contracts-implementation": "^4.0"
45+
"phplrt/exception-contracts-implementation": "^3.7"
4646
},
4747
"extra": {
4848
"branch-alias": {
49-
"dev-master": "4.x-dev",
50-
"dev-main": "4.x-dev"
49+
"dev-master": "3.x-dev",
50+
"dev-main": "3.x-dev"
5151
}
5252
},
5353
"config": {

src/ErrorInformationRenderer.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ class ErrorInformationRenderer
3636

3737
private string $highlightChar = self::DEFAULT_HIGHLIGHT_CHAR;
3838

39-
public function __construct(
40-
ReadableInterface $source,
41-
private readonly TokenInterface $token,
42-
) {
43-
$this->position = Position::fromOffset($source, $this->token->getOffset());
39+
private TokenInterface $token;
40+
41+
public function __construct(ReadableInterface $source, TokenInterface $token)
42+
{
43+
$this->token = $token;
44+
45+
$this->position = Position::fromOffset($source, $token->getOffset());
4446

4547
$this->reader = new LineReader($source);
4648
}

src/RuntimeException.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ abstract class RuntimeException extends \RuntimeException implements RuntimeExce
1818

1919
private ?ReadableInterface $source = null;
2020

21-
public function __construct(
22-
private readonly string $original = '',
23-
int $code = 0,
24-
?\Throwable $previous = null,
25-
) {
26-
parent::__construct($this->original, $code, $previous);
21+
private string $original;
22+
23+
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null)
24+
{
25+
$this->original = $message;
26+
27+
parent::__construct($message, $code, $previous);
2728
}
2829

2930
public function getOriginalMessage(): string

src/UndefinedToken.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66

77
use Phplrt\Contracts\Lexer\TokenInterface;
88
use Phplrt\Contracts\Position\PositionInterface;
9-
use Phplrt\Lexer\Token\EndOfInput;
109

1110
/**
1211
* @internal This class can be used for internal representation of exceptions
1312
*/
1413
final class UndefinedToken implements TokenInterface
1514
{
16-
public function __construct(
17-
private readonly PositionInterface $position,
18-
) {}
15+
private PositionInterface $position;
16+
17+
public function __construct(PositionInterface $position)
18+
{
19+
$this->position = $position;
20+
}
1921

2022
public function getName(): string
2123
{
22-
return EndOfInput::DEFAULT_TOKEN_NAME;
24+
return TokenInterface::END_OF_INPUT;
2325
}
2426

2527
public function getOffset(): int

tests/Unit/UndefinedTokenTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Phplrt\Contracts\Lexer\TokenInterface;
88
use Phplrt\Exception\UndefinedToken;
9-
use Phplrt\Lexer\Token\EndOfInput;
109
use Phplrt\Position\Position;
1110

1211
class UndefinedTokenTest extends TestCase
@@ -20,7 +19,7 @@ public function testName(): void
2019
{
2120
$token = $this->create();
2221

23-
$this->assertSame(EndOfInput::DEFAULT_TOKEN_NAME, $token->getName());
22+
$this->assertSame(TokenInterface::END_OF_INPUT, $token->getName());
2423
}
2524

2625
public function testOffset(): void

0 commit comments

Comments
 (0)