Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions src/Chess.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public function undo(): ?Move
/**
* @return array<int, Move>
*/
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);

Expand Down Expand Up @@ -593,7 +593,7 @@ public function move($sanOrArray): ?Move
*
* @return array<int, Move>
*/
public function moves(int $square = null): array
public function moves(?int $square = null): array
{
$moves = [];
foreach ($this->generateMoves($square) as $key => $move) {
Expand Down
2 changes: 1 addition & 1 deletion src/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class History
private array $entries;

/** @param array<int, Entry>|null $entries */
public function __construct(array $entries = null)
public function __construct(?array $entries = null)
{
$this->entries = $entries ?? [];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Move.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Piece.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class Piece implements \JsonSerializable
private string $color;

/** @var array<string> */
private static $types = [
private static array $types = [
self::PAWN,
self::KNIGHT,
self::BISHOP,
Expand All @@ -58,10 +58,10 @@ final class Piece implements \JsonSerializable
];

/** @var array<string> */
private static $colors = [self::BLACK, self::WHITE];
private static array $colors = [self::BLACK, self::WHITE];

/** @var array<string, string[]> */
private static $pieces = [
private static array $pieces = [
self::BLACK => [
self::PAWN => '♟',
self::KNIGHT => '♞',
Expand Down
2 changes: 1 addition & 1 deletion tests/ChessPublicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function attackedPublic(string $color, int $square): bool
/**
* @return array<int, Move>
*/
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);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/MoveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public static function testSANMoveFromRealGame(string $match, string $finalFen):
/**
* @return array<string, array<int, string>>
*/
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';
Expand Down
2 changes: 1 addition & 1 deletion tests/PerftTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function testPerft(string $fen, int $expectedDeep1, int $expectedD
/**
* @return array<string, array<int, int|string>>
*/
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],
Expand Down
Loading