From 9e6cbb5b6a4e23736c6482fd1ab56edbba1987aa Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 29 Jan 2020 20:20:52 +0000 Subject: [PATCH] Internet: fix type information for getURL(), postURL() and simpleCurl() --- src/pocketmine/utils/Internet.php | 14 ++++++++------ src/pocketmine/utils/Utils.php | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/pocketmine/utils/Internet.php b/src/pocketmine/utils/Internet.php index 732865c36..56dd8e3c5 100644 --- a/src/pocketmine/utils/Internet.php +++ b/src/pocketmine/utils/Internet.php @@ -134,10 +134,11 @@ 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 * * @return bool|mixed false if an error occurred, mixed data if successful. */ @@ -156,8 +157,9 @@ class Internet{ * 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[] $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 array[] $headers reference parameter + * @param string[] $headers reference parameter * @param int $httpCode reference parameter * * @return bool|mixed false if an error occurred, mixed data if successful. @@ -185,7 +187,7 @@ class Internet{ * @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. * @phpstan-param (callable(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 * * @throws InternetException if a cURL error occurs */ diff --git a/src/pocketmine/utils/Utils.php b/src/pocketmine/utils/Utils.php index 10ce678eb..46a625341 100644 --- a/src/pocketmine/utils/Utils.php +++ b/src/pocketmine/utils/Utils.php @@ -420,10 +420,11 @@ class Utils{ * @deprecated * @see Internet::getURL() * - * @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 * * @return bool|mixed false if an error occurred, mixed data if successful. */ @@ -436,8 +437,9 @@ class Utils{ * @see Internet::postURL() * * @param array|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 array[] $headers reference parameter + * @param string[] $headers reference parameter * @param int $httpCode reference parameter * * @return bool|mixed false if an error occurred, mixed data if successful. @@ -456,7 +458,7 @@ class Utils{ * @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. * @phpstan-param (callable(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 * * @throws \RuntimeException if a cURL error occurs */