diff --git a/src/utils/Internet.php b/src/utils/Internet.php index fd9bc92fd..8c2c21f5b 100644 --- a/src/utils/Internet.php +++ b/src/utils/Internet.php @@ -134,12 +134,15 @@ class Internet{ * GETs an URL using cURL * NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread. * - * @param int $timeout default 10 - * @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation. - * @param array[] $headers reference parameter - * @param int $httpCode reference parameter + * @param int $timeout default 10 + * @param string[] $extraHeaders + * @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation. + * @param string[] $headers reference parameter + * @param int $httpCode reference parameter + * @phpstan-param list $extraHeaders + * @phpstan-param array $headers * - * @return bool|mixed false if an error occurred, mixed data if successful. + * @return string|false */ public static function getURL(string $page, int $timeout = 10, array $extraHeaders = [], &$err = null, &$headers = null, &$httpCode = null){ try{ @@ -155,12 +158,16 @@ class Internet{ * POSTs data to an URL * NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread. * - * @param array|string $args - * @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation. - * @param array[] $headers reference parameter - * @param int $httpCode reference parameter + * @param string[]|string $args + * @param string[] $extraHeaders + * @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation. + * @param string[] $headers reference parameter + * @param int $httpCode reference parameter + * @phpstan-param string|array $args + * @phpstan-param list $extraHeaders + * @phpstan-param array $headers * - * @return bool|mixed false if an error occurred, mixed data if successful. + * @return string|false */ public static function postURL(string $page, $args, int $timeout = 10, array $extraHeaders = [], &$err = null, &$headers = null, &$httpCode = null){ try{ @@ -181,11 +188,14 @@ class Internet{ * * @param float|int $timeout The maximum connect timeout and timeout in seconds, correct to ms. * @param string[] $extraHeaders extra headers to send as a plain string array - * @param array $extraOpts extra CURLOPT_* to set as an [opt => value] map - * @param \Closure|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. + * @param array $extraOpts extra CURLOPT_* to set as an [opt => value] map + * @param \Closure|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. + * @phpstan-param array $extraOpts + * @phpstan-param list $extraHeaders * @phpstan-param (\Closure(resource) : void)|null $onSuccess * - * @return array a plain array of three [result body : string, headers : array[], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values + * @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values + * @phpstan-return array{string, list>, int} * * @throws InternetException if a cURL error occurs */