phpokeapi
phpokeapi copied to clipboard
Client breaks when a NetworkException is thrown
Whenever a call to PokeAPI returns an http code different from 200, Client attempts to throw a NetworkException, which cannot be built due to conflicts with the inherited \Exception constructor.
To reproduce:
$api = new \PokeAPI\Client();
$api->pokemon('badName')->getId();
Possible hotfix
Replace:
throw new NetworkException($url, $data);
with:
throw NetworkException::create($url, $data);
in Client.php:699