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.
Supporting PHP8
implode(array $array, string $separator): string
$playerWith3Pieces = count($whitePieces) === 3 ? $whitePieces : $blackPieces;
E_WARNING: Undefined array key 2