Uncaught TypeError: Return value of OwenVoke\OpenSea\Api\Asset::all() must be of the type array, string returned
Description
Fatal error: Uncaught TypeError: Return value of OwenVoke\OpenSea\Api\Asset::all() must be of the type array, string returned
Environment
- PHP 7.4:
Hi. Simple code
require_once __DIR__ . '/vendor/autoload.php';
use OwenVoke\OpenSea\Client;
$client = new Client();
$assets = $client->assets();
print_r($assets->all());
I find error - CloudFlare blocked status 404 and error code: 1020 I think - need add exception if get errors
If it's a 404, this definitely should have thrown an exception (depending on your HTTP client package). Not sure why it wouldn't...
I'll try and replicate this later. 👍🏻
I lied - 403 error
Ah, 403 should still error though. 🤔 Just to check, are you using this package with Guzzle?
Yes Clear project - instal: composer require owenvoke/opensea guzzlehttp/guzzle:^7.0.1 http-interop/http-factory-guzzle:^1.0 and simple example
Not entirely sure why the 403 error isn't being converted to an exception, however, it looks like the /assets endpoint now requires an API key. Not sure if you already have one, but if not, you can request one here.
~~I'll look into why Guzzle isn't throwing an exception over the next few days. 👍🏻~~ Looks like HTTPlug doesn't implement exception handling by default (which I thought it did as Guzzle usually does). Looks like I'll need to implement this similarly to how the PHP GitHub API package does.