ChessCom / Chess-Game

Based on Pear Games_Chess - represents a chess game as a php object
Other
42 stars 20 forks source link

PHP8 support #42

Closed bojanpejic closed 2 years ago

bojanpejic commented 2 years ago

Supporting PHP8

implode(array $array, string $separator): string


- fixing the case where 4 pieces are remained

$playerWith3Pieces = count($whitePieces) === 3 ? $whitePieces : $blackPieces;

This line was auto suggesting that in case of remained 4 pieces on board, in case that white doesn't have 3 pieces remained, that black has 3 pieces remained, while there are actual cases where it is 2 white vs 2 black pieces. 
This was giving a warning, since there wasn't 3 elements in the array, just two:

E_WARNING: Undefined array key 2



So far we have experienced these issues using Chess-Game library on PHP8, I hope there isn't any additional.