/**
* @param array &$req HTTP request map
+ * @codingStandardsIgnoreStart
+ * @phan-param array{url:string,proxy?:?string,query:mixed,method:string,body:string|resource,headers:string[],stream?:resource,flags:array} $req
+ * @codingStandardsIgnoreEnd
* @param array $opts
* - connTimeout : default connection timeout
* - reqTimeout : default request timeout
* @return resource
* @throws Exception
- * @suppress PhanTypeMismatchArgumentInternal
*/
protected function getCurlHandle( array &$req, array $opts ) {
$ch = curl_init();
}
$length = strlen( $header );
$matches = [];
- if ( preg_match( "/^(HTTP\/1\.[01]) (\d{3}) (.*)/", $header, $matches ) ) {
+ if ( preg_match( "/^(HTTP\/(?:1\.[01]|2)) (\d{3}) (.*)/", $header, $matches ) ) {
$req['response']['code'] = (int)$matches[2];
$req['response']['reason'] = trim( $matches[3] );
return $length;
if ( $hasOutputStream ) {
return fwrite( $req['stream'], $data );
} else {
+ // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
$req['response']['body'] .= $data;
return strlen( $data );