@@ -31,27 +31,27 @@ class ApiCall
3131 /**
3232 * @var \GuzzleHttp\Client
3333 */
34- private $ client ;
34+ private \ GuzzleHttp \ Client $ client ;
3535
3636 /**
3737 * @var \Typesence\Lib\Configuration
3838 */
39- private $ config ;
39+ private Configuration $ config ;
4040
4141 /**
4242 * @var array|\Typesence\Lib\Node[]
4343 */
44- private static $ nodes ;
44+ private static array $ nodes ;
4545
4646 /**
47- * @var \Typesence\Lib\Node
47+ * @var \Typesence\Lib\Node|null
4848 */
49- private static $ nearestNode ;
49+ private static ? Node $ nearestNode ;
5050
5151 /**
5252 * @var int
5353 */
54- private $ nodeIndex ;
54+ private int $ nodeIndex ;
5555
5656 /**
5757 * ApiCall constructor.
@@ -182,14 +182,14 @@ private function makeRequest(string $method, string $endPoint, bool $asJson, arr
182182
183183 if (!(200 <= $ statusCode && $ statusCode < 300 )) {
184184 $ errorMessage = json_decode ($ response ->getBody ()
185- ->getContents (), true )['message ' ] ?? 'API error. ' ;
185+ ->getContents (), true , 512 , JSON_THROW_ON_ERROR )['message ' ] ?? 'API error. ' ;
186186 throw $ this ->getException ($ statusCode )
187187 ->setMessage ($ errorMessage );
188188 }
189189
190190 return $ asJson ? json_decode ($ response ->getBody ()
191- ->getContents (), true ) : $ response ->getBody ()
192- ->getContents ();
191+ ->getContents (), true , 512 , JSON_THROW_ON_ERROR ) : $ response ->getBody ()
192+ ->getContents ();
193193 } catch (ClientException $ exception ) {
194194 if ($ exception ->getResponse ()
195195 ->getStatusCode () === 408 ) {
0 commit comments