Skip to content

Commit

Permalink
Remove php 7.4 and 8.0 from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Aug 2, 2024
1 parent cb68ea0 commit aed8a99
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
12 changes: 5 additions & 7 deletions src/ErrorInformationRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ class ErrorInformationRenderer

private string $highlightChar = self::DEFAULT_HIGHLIGHT_CHAR;

private TokenInterface $token;

public function __construct(ReadableInterface $source, TokenInterface $token)
{
$this->token = $token;

$this->position = Position::fromOffset($source, $token->getOffset());
public function __construct(
ReadableInterface $source,
private readonly TokenInterface $token,
) {
$this->position = Position::fromOffset($source, $this->token->getOffset());

$this->reader = new LineReader($source);
}
Expand Down
13 changes: 6 additions & 7 deletions src/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ abstract class RuntimeException extends \RuntimeException implements RuntimeExce

private ?ReadableInterface $source = null;

private string $original;

public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null)
{
$this->original = $message;

parent::__construct($message, $code, $previous);
public function __construct(
private readonly string $original = '',
int $code = 0,
?\Throwable $previous = null,
) {
parent::__construct($this->original, $code, $previous);
}

public function getOriginalMessage(): string
Expand Down
12 changes: 5 additions & 7 deletions src/UndefinedToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@

use Phplrt\Contracts\Lexer\TokenInterface;
use Phplrt\Contracts\Position\PositionInterface;
use Phplrt\Lexer\Token\EndOfInput;

/**
* @internal This class can be used for internal representation of exceptions
*/
final class UndefinedToken implements TokenInterface
{
private PositionInterface $position;

public function __construct(PositionInterface $position)
{
$this->position = $position;
}
public function __construct(
private readonly PositionInterface $position,
) {}

public function getName(): string
{
return TokenInterface::END_OF_INPUT;
return EndOfInput::DEFAULT_TOKEN_NAME;
}

public function getOffset(): int
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/UndefinedTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Phplrt\Contracts\Lexer\TokenInterface;
use Phplrt\Exception\UndefinedToken;
use Phplrt\Lexer\Token\EndOfInput;
use Phplrt\Position\Position;

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

$this->assertSame(TokenInterface::END_OF_INPUT, $token->getName());
$this->assertSame(EndOfInput::DEFAULT_TOKEN_NAME, $token->getName());
}

public function testOffset(): void
Expand Down

0 comments on commit aed8a99

Please sign in to comment.