diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 00c8564..86be36d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - php: ["7.4", "8.0", "8.1", "8.2", "8.3"] + php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"] name: php-${{ matrix.php }} diff --git a/src/Chess.php b/src/Chess.php index 5d9df43..3364ac4 100644 --- a/src/Chess.php +++ b/src/Chess.php @@ -393,7 +393,7 @@ public function undo(): ?Move /** * @return array */ - protected function generateMoves(int $square = null, bool $legal = true): array + protected function generateMoves(?int $square = null, bool $legal = true): array { $cacheKey = $this->boardHash.\json_encode($square.($legal ? '1' : '0'), JSON_THROW_ON_ERROR); @@ -593,7 +593,7 @@ public function move($sanOrArray): ?Move * * @return array */ - public function moves(int $square = null): array + public function moves(?int $square = null): array { $moves = []; foreach ($this->generateMoves($square) as $key => $move) { diff --git a/src/History.php b/src/History.php index 42e8ec0..c80ed3a 100644 --- a/src/History.php +++ b/src/History.php @@ -10,7 +10,7 @@ final class History private array $entries; /** @param array|null $entries */ - public function __construct(array $entries = null) + public function __construct(?array $entries = null) { $this->entries = $entries ?? []; } diff --git a/src/Move.php b/src/Move.php index 2b0f93d..759d6c8 100644 --- a/src/Move.php +++ b/src/Move.php @@ -34,7 +34,7 @@ final class Move implements \JsonSerializable public ?string $promotion; - public ?string $san; + public ?string $san = null; public function __construct(string $turn, int $flags, Piece $piece, int $from, int $to, ?string $captured = null, ?string $promotion = null) { diff --git a/src/Piece.php b/src/Piece.php index 53a2938..866e0fa 100644 --- a/src/Piece.php +++ b/src/Piece.php @@ -48,7 +48,7 @@ final class Piece implements \JsonSerializable private string $color; /** @var array */ - private static $types = [ + private static array $types = [ self::PAWN, self::KNIGHT, self::BISHOP, @@ -58,10 +58,10 @@ final class Piece implements \JsonSerializable ]; /** @var array */ - private static $colors = [self::BLACK, self::WHITE]; + private static array $colors = [self::BLACK, self::WHITE]; /** @var array */ - private static $pieces = [ + private static array $pieces = [ self::BLACK => [ self::PAWN => '♟', self::KNIGHT => '♞', diff --git a/tests/ChessPublicator.php b/tests/ChessPublicator.php index 4b308fc..cc8155b 100644 --- a/tests/ChessPublicator.php +++ b/tests/ChessPublicator.php @@ -30,7 +30,7 @@ public function attackedPublic(string $color, int $square): bool /** * @return array */ - public function generateMovesPublic(int $square = null, bool $legal = true): array + public function generateMovesPublic(?int $square = null, bool $legal = true): array { return $this->generateMoves($square, $legal); } diff --git a/tests/MoveTest.php b/tests/MoveTest.php index cd142ce..dd04364 100644 --- a/tests/MoveTest.php +++ b/tests/MoveTest.php @@ -488,7 +488,7 @@ public static function testSANMoveFromRealGame(string $match, string $finalFen): /** * @return array> */ - public function gameProvider(): array + public static function gameProvider(): array { $match1 = 'e4 e5 Nf3 Nc6 d4 exd4 Nxd4 Nf6 Nc3 Bb4 Nxc6 bxc6 Qd4 Qe7 f3 d5 Bg5 O-O O-O-O Bc5 Bxf6 gxf6 Qa4 '. 'Be3+ Kb1 d4 Ne2 c5 Nc1 Be6 Bc4 Rfb8 Nd3 Rb6'; diff --git a/tests/PerftTest.php b/tests/PerftTest.php index 661831c..701dd51 100644 --- a/tests/PerftTest.php +++ b/tests/PerftTest.php @@ -23,7 +23,7 @@ public static function testPerft(string $fen, int $expectedDeep1, int $expectedD /** * @return array> */ - public function provider(): array + public static function provider(): array { return [ 'initial position' => ['rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', 20, 400],