provide more array type information for Internet functions

This commit is contained in:
Dylan K. Taylor 2020-01-29 20:45:03 +00:00
parent e007fad5b8
commit 9cdea43794
2 changed files with 26 additions and 10 deletions

View File

@ -139,6 +139,8 @@ class Internet{
* @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<string> $extraHeaders
* @phpstan-param array<string, string> $headers
*
* @return string|false
*/
@ -156,11 +158,14 @@ 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[] $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
* @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<string, string> $args
* @phpstan-param list<string> $extraHeaders
* @phpstan-param array<string, string> $headers
*
* @return string|false
*/
@ -185,9 +190,12 @@ class Internet{
* @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 callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
* @phpstan-param array<int, mixed> $extraOpts
* @phpstan-param list<string> $extraHeaders
* @phpstan-param (callable(resource) : void)|null $onSuccess
*
* @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<array<string, string>>, int}
*
* @throws InternetException if a cURL error occurs
*/

View File

@ -425,6 +425,8 @@ class Utils{
* @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<string> $extraHeaders
* @phpstan-param array<string, string> $headers
*
* @return string|false
*/
@ -436,11 +438,14 @@ class Utils{
* @deprecated
* @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 string[] $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<string, string> $args
* @phpstan-param list<string> $extraHeaders
* @phpstan-param array<string, string> $headers
*
* @return string|false
*/
@ -456,9 +461,12 @@ class Utils{
* @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 callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
* @phpstan-param array<int, mixed> $extraOpts
* @phpstan-param list<string> $extraHeaders
* @phpstan-param (callable(resource) : void)|null $onSuccess
*
* @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<array<string, string>>, int}
*
* @throws \RuntimeException if a cURL error occurs
*/