Skip to content

Commit

Permalink
Object serialization micro-optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Jan 14, 2025
1 parent 9f2af0c commit a05d7fc
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Variant/AbstractPiece.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Chess\Variant\Classical\PGN\AN\Castle;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\Rule\CastlingRule;
use Chess\Variant\Classical\CastlingRule;

abstract class AbstractPiece
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Capablanca/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Chess\Variant\VariantType;
use Chess\Variant\Capablanca\A;
use Chess\Variant\Capablanca\C;
use Chess\Variant\Capablanca\Rule\CastlingRule;
use Chess\Variant\Capablanca\CastlingRule;
use Chess\Variant\Capablanca\PGN\Move;
use Chess\Variant\Capablanca\PGN\AN\Square;
use Chess\Variant\Classical\B;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Chess\Variant\Capablanca\Rule;
namespace Chess\Variant\Capablanca;

use Chess\Variant\Classical\PGN\AN\Castle;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\Rule\CastlingRule as ClassicalCastlingRule;
use Chess\Variant\Classical\CastlingRule as ClassicalCastlingRule;

class CastlingRule extends ClassicalCastlingRule
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Capablanca/FEN/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Chess\Variant\Capablanca\FEN\PiecePlacement;
use Chess\Variant\Capablanca\PGN\AN\Square;
use Chess\Variant\Capablanca\Rule\CastlingRule;
use Chess\Variant\Capablanca\CastlingRule;
use Chess\Variant\Classical\FEN\Str as ClassicalFenStr;
use Chess\Variant\Classical\PGN\AN\Color;

Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Capablanca/FEN/StrToBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Chess\Variant\PieceArray;
use Chess\Variant\VariantType;
use Chess\Variant\Capablanca\Board;
use Chess\Variant\Capablanca\CastlingRule;
use Chess\Variant\Capablanca\FEN\Str;
use Chess\Variant\Capablanca\PGN\AN\Square;
use Chess\Variant\Capablanca\Rule\CastlingRule;
use Chess\Variant\Classical\FEN\StrToBoard as ClassicalFenStrToBoard;

class StrToBoard extends ClassicalFenStrToBoard
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/CapablancaFischer/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Chess\Variant\VariantType;
use Chess\Variant\Capablanca\PGN\Move;
use Chess\Variant\Capablanca\PGN\AN\Square;
use Chess\Variant\CapablancaFischer\CastlingRule;
use Chess\Variant\CapablancaFischer\StartPieces;
use Chess\Variant\CapablancaFischer\Rule\CastlingRule;
use Chess\Variant\Classical\PGN\AN\Color;

class Board extends AbstractBoard implements RandomBoardInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Chess\Variant\CapablancaFischer\Rule;
namespace Chess\Variant\CapablancaFischer;

use Chess\Variant\RandomCastlingRuleTrait;
use Chess\Variant\Capablanca\PGN\AN\Square;
use Chess\Variant\Capablanca\Rule\CastlingRule as CapablancaCastlingRule;
use Chess\Variant\Capablanca\CastlingRule as CapablancaCastlingRule;

class CastlingRule extends CapablancaCastlingRule
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/CapablancaFischer/FEN/StrToBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Chess\Variant\PieceArray;
use Chess\Variant\VariantType;
use Chess\Variant\CapablancaFischer\Board;
use Chess\Variant\CapablancaFischer\Rule\CastlingRule;
use Chess\Variant\CapablancaFischer\CastlingRule;
use Chess\Variant\Capablanca\FEN\Str;
use Chess\Variant\Capablanca\PGN\AN\Square;
use Chess\Variant\Classical\FEN\StrToBoard as ClassicalFenStrToBoard;
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Chess960/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Chess\Variant\Classical\PGN\Move;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Chess960\CastlingRule;
use Chess\Variant\Chess960\StartPieces;
use Chess\Variant\Chess960\Rule\CastlingRule;

class Board extends AbstractBoard implements RandomBoardInterface
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Chess\Variant\Chess960\Rule;
namespace Chess\Variant\Chess960;

use Chess\Variant\RandomCastlingRuleTrait;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule as ClassicalCastlingRule;
use Chess\Variant\Classical\CastlingRule as ClassicalCastlingRule;

class CastlingRule extends ClassicalCastlingRule
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Chess960/FEN/StrToBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Chess\Variant\PieceArray;
use Chess\Variant\VariantType;
use Chess\Variant\Chess960\Board;
use Chess\Variant\Chess960\Rule\CastlingRule;
use Chess\Variant\Chess960\CastlingRule;
use Chess\Variant\Classical\FEN\Str;
use Chess\Variant\Classical\FEN\StrToBoard as ClassicalFenStrToBoard;
use Chess\Variant\Classical\PGN\AN\Square;
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Classical/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Chess\Variant\Classical\P;
use Chess\Variant\Classical\Q;
use Chess\Variant\Classical\R;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\PGN\Move;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;

class Board extends AbstractBoard
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Chess\Variant\Classical\Rule;
namespace Chess\Variant\Classical;

use Chess\Exception\UnknownNotationException;
use Chess\Variant\AbstractNotation;
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Classical/FEN/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Chess\Variant\Classical\FEN\PiecePlacement;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;
use Chess\Variant\Classical\CastlingRule;

class Str
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Classical/FEN/StrToBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use Chess\Variant\PieceArray;
use Chess\Variant\VariantType;
use Chess\Variant\Classical\Board;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\FEN\Str;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;

class StrToBoard
{
Expand Down
3 changes: 1 addition & 2 deletions src/Variant/Classical/PGN/Move.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
namespace Chess\Variant\Classical\PGN;

use Chess\Exception\UnknownNotationException;
use Chess\Piece\K;
use Chess\Variant\AbstractNotation;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\PGN\AN\Castle;
use Chess\Variant\Classical\PGN\AN\Check;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;

class Move extends AbstractNotation
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Dunsany/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
use Chess\Variant\Classical\P;
use Chess\Variant\Classical\Q;
use Chess\Variant\Classical\R;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\PGN\Move;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;

class Board extends AbstractBoard
{
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Dunsany/FEN/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Chess\Variant\Classical\FEN\Str as ClassicalStr;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Dunsany\FEN\PiecePlacement;

class Str extends ClassicalStr
Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Dunsany/FEN/StrToBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Chess\Variant\AbstractBoard;
use Chess\Variant\PieceArray;
use Chess\Variant\VariantType;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\FEN\StrToBoard as ClassicalFenStrToBoard;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;
use Chess\Variant\Dunsany\Board;
use Chess\Variant\Dunsany\FEN\Str;

Expand Down
2 changes: 1 addition & 1 deletion src/Variant/Losing/FEN/StrToBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Chess\Variant\AbstractBoard;
use Chess\Variant\PieceArray;
use Chess\Variant\VariantType;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\FEN\StrToBoard as ClassicalFenStrToBoard;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;
use Chess\Variant\Losing\Board;
use Chess\Variant\Losing\FEN\Str;

Expand Down
2 changes: 1 addition & 1 deletion src/Variant/PieceArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\Rule\CastlingRule;
use Chess\Variant\Classical\CastlingRule;

class PieceArray
{
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Variant/Classical/BoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
use Chess\Variant\Classical\P;
use Chess\Variant\Classical\Q;
use Chess\Variant\Classical\R;
use Chess\Variant\Classical\Board;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\FEN\StrToBoard;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\PGN\AN\Square;
use Chess\Variant\Classical\PGN\Move;
use Chess\Variant\Classical\Board;
use Chess\Variant\Classical\Rule\CastlingRule;

class BoardTest extends AbstractUnitTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Variant/Classical/KTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Chess\Tests\AbstractUnitTestCase;
use Chess\Variant\Capablanca\PGN\AN\Square as CapablancaSquare;
use Chess\Variant\Classical\K;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\PGN\AN\Castle;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\PGN\AN\Square as ClassicalSquare;
use Chess\Variant\Classical\Rule\CastlingRule;

class KTest extends AbstractUnitTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Variant/Classical/PGN/MoveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

use Chess\Piece\K;
use Chess\Tests\AbstractUnitTestCase;
use Chess\Variant\Classical\CastlingRule;
use Chess\Variant\Classical\PGN\Move;
use Chess\Variant\Classical\PGN\AN\Castle;
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;
use Chess\Variant\Classical\Rule\CastlingRule;

class MoveTest extends AbstractUnitTestCase
{
Expand Down

0 comments on commit a05d7fc

Please sign in to comment.