/** * @param Player|null $not * @return Player */ private function randomPlayer(Player $not = null) { while (true) { $random = $this->faker->randomElement($this->players); if ($not === null) { return $random; } if ($random->getName() !== $not->getName()) { return $random; } } return null; }