1 | <?php |
||
13 | class BaseClient |
||
14 | { |
||
15 | use HasHttpRequests { |
||
16 | request as performRequest; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * @var \Kaylyu\Alipay\Kernel\ServiceContainer |
||
21 | */ |
||
22 | protected $app; |
||
23 | |||
24 | /** |
||
25 | * @var |
||
26 | */ |
||
27 | protected $baseUri; |
||
28 | |||
29 | /** |
||
30 | * BaseClient constructor. |
||
31 | * |
||
32 | * @param \Kaylyu\Alipay\Kernel\ServiceContainer $app |
||
33 | */ |
||
34 | public function __construct(ServiceContainer $app) |
||
38 | |||
39 | /** |
||
40 | * GET request. |
||
41 | * |
||
42 | * @param string $url |
||
43 | * @param array $query |
||
44 | * @param array $forceArrayKeys |
||
45 | * |
||
46 | * @return \Psr\Http\Message\ResponseInterface|\Kaylyu\Alipay\Kernel\Support\Collection|array|object|string |
||
47 | * |
||
48 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidConfigException |
||
49 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\Exception |
||
50 | */ |
||
51 | public function httpGet(string $url, array $query = [], array $forceArrayKeys = []) |
||
55 | |||
56 | /** |
||
57 | * POST request. |
||
58 | * |
||
59 | * @param string $url |
||
60 | * @param array $data |
||
61 | * @param array $forceArrayKeys |
||
62 | * |
||
63 | * @return \Psr\Http\Message\ResponseInterface|\Kaylyu\Alipay\Kernel\Support\Collection|array|object|string |
||
64 | * |
||
65 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidConfigException |
||
66 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\Exception |
||
67 | */ |
||
68 | public function httpPost(string $url, array $data = [], array $forceArrayKeys = []) |
||
72 | |||
73 | /** |
||
74 | * JSON request. |
||
75 | * |
||
76 | * @param string $url |
||
77 | * @param array $data |
||
78 | * @param array $forceArrayKeys |
||
79 | * |
||
80 | * @return \Psr\Http\Message\ResponseInterface|\Kaylyu\Alipay\Kernel\Support\Collection|array|object|string |
||
81 | * |
||
82 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidConfigException |
||
83 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\Exception |
||
84 | */ |
||
85 | public function httpPostJson(string $url, array $data = [], array $forceArrayKeys = []) |
||
89 | |||
90 | /** |
||
91 | * Upload file. |
||
92 | * |
||
93 | * @param string $url |
||
94 | * @param array $files |
||
95 | * @param array $form |
||
96 | * @param array $query |
||
97 | * |
||
98 | * @return \Psr\Http\Message\ResponseInterface|\Kaylyu\Alipay\Kernel\Support\Collection|array|object|string |
||
99 | * |
||
100 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidConfigException |
||
101 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\Exception |
||
102 | */ |
||
103 | public function httpUpload(string $url, array $files = [], array $form = [], array $query = []) |
||
126 | |||
127 | /** |
||
128 | * @param string $url |
||
129 | * @param string $method |
||
130 | * @param array $options |
||
131 | * @param bool $returnRaw |
||
132 | * @param array $forceArrayKeys |
||
133 | * |
||
134 | * @return \Psr\Http\Message\ResponseInterface|\Kaylyu\Alipay\Kernel\Support\Collection|array|object|string |
||
135 | * |
||
136 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidConfigException |
||
137 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\Exception |
||
138 | */ |
||
139 | public function request(string $url, string $method = 'GET', array $options = [], $returnRaw = false, array $forceArrayKeys = []) |
||
150 | |||
151 | /** |
||
152 | * @param string $url |
||
153 | * @param string $method |
||
154 | * @param array $options |
||
155 | * |
||
156 | * @return \Kaylyu\Alipay\Kernel\Http\Response |
||
157 | * |
||
158 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidConfigException |
||
159 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\Exception |
||
160 | */ |
||
161 | public function requestRaw(string $url, string $method = 'GET', array $options = []) |
||
165 | |||
166 | /** |
||
167 | * Register Guzzle middlewares. |
||
168 | */ |
||
169 | protected function registerHttpMiddlewares() |
||
174 | |||
175 | /** |
||
176 | * Log the request. |
||
177 | * |
||
178 | * @return \Closure |
||
179 | */ |
||
180 | protected function logMiddleware() |
||
186 | } |
||
187 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: