作者 竞泽

fix:未返回内容

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