作者 竞泽

fix:未返回内容

... ... @@ -5,6 +5,7 @@ namespace Lackoxygen\TopWarehouse;
use Illuminate\Support\Arr;
use Lackoxygen\TopWarehouse\Constants\ResponseCode;
use Lackoxygen\TopWarehouse\Contracts\ResponseInterface;
use Lackoxygen\TopWarehouse\Exception\Exception;
use Lackoxygen\TopWarehouse\Utils\JsonUtil;
use Psr\Http\Message\ResponseInterface as PsrResponseInterface;
... ... @@ -60,7 +61,7 @@ class Response implements ResponseInterface
*/
public function toArray(): array
{
return JsonUtil::decode($this->getContents());
return (array)JsonUtil::decode($this->getContents());
}
/**
... ...
... ... @@ -4,6 +4,8 @@
namespace Lackoxygen\TopWarehouse\Utils;
use Lackoxygen\TopWarehouse\Exception\Exception;
class JsonUtil
{
public static function encode($array, int $flags = JSON_UNESCAPED_UNICODE, int $depth = 512)
... ... @@ -11,7 +13,7 @@ class JsonUtil
return json_encode($array, $flags, $depth);
}
public static function decode(string $json, ?bool $associative = true, int $depth = 512): array
public static function decode(string $json, ?bool $associative = true, int $depth = 512)
{
return json_decode($json, $associative, $depth);
}
... ...