修复华为云存储报错

This commit is contained in:
2025-05-11 10:02:08 +08:00
parent 4ff29bed97
commit 7934afeb04
4 changed files with 93 additions and 93 deletions

View File

@@ -38,7 +38,7 @@ class SdkStreamHandler
{
private $lastHeaders = [];
public function __invoke(RequestInterface $request, array $options)
public function __invoke(?RequestInterface $request, ?array $options)
{
if (isset($options['delay'])) {
usleep($options['delay'] * 1000);
@@ -77,10 +77,10 @@ class SdkStreamHandler
}
private function invokeStats(
array $options,
RequestInterface $request,
?array $options,
?RequestInterface $request,
$startTime,
ResponseInterface $response = null,
?ResponseInterface $response = null,
$error = null
) {
if (isset($options['on_stats'])) {
@@ -96,8 +96,8 @@ class SdkStreamHandler
}
private function createResponse(
RequestInterface $request,
array $options,
?RequestInterface $request,
?array $options,
$stream,
$startTime
) {
@@ -141,7 +141,7 @@ class SdkStreamHandler
return new FulfilledPromise($response);
}
private function createSink(StreamInterface $stream, array $options)
private function createSink(StreamInterface $stream, ?array $options)
{
if (!empty($options['stream'])) {
return $stream;
@@ -156,7 +156,7 @@ class SdkStreamHandler
: \GuzzleHttp\Psr7\Utils::streamFor($sink);
}
private function checkDecode(array $options, array $headers, $stream)
private function checkDecode(?array $options, ?array $headers, $stream)
{
if (!empty($options['decode_content'])) {
$normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
@@ -232,7 +232,7 @@ class SdkStreamHandler
return $resource;
}
private function createStream(RequestInterface $request, array $options)
private function createStream(?RequestInterface $request, ?array $options)
{
static $methods;
if (!$methods) {
@@ -309,7 +309,7 @@ class SdkStreamHandler
);
}
private function resolveHost(RequestInterface $request, array $options)
private function resolveHost(?RequestInterface $request, ?array $options)
{
$uri = $request->getUri();
@@ -332,7 +332,7 @@ class SdkStreamHandler
return $uri;
}
private function getDefaultContext(RequestInterface $request)
private function getDefaultContext(?RequestInterface $request)
{
$headers = '';
foreach ($request->getHeaders() as $name => $value) {
@@ -365,7 +365,7 @@ class SdkStreamHandler
return $context;
}
private function add_proxy(RequestInterface $request, &$options, $value, &$params)
private function add_proxy(?RequestInterface $request, &$options, $value, &$params)
{
if (!is_array($value)) {
$options['http']['proxy'] = $value;
@@ -384,14 +384,14 @@ class SdkStreamHandler
}
}
private function add_timeout(RequestInterface $request, &$options, $value, &$params)
private function add_timeout(?RequestInterface $request, &$options, $value, &$params)
{
if ($value > 0) {
$options['http']['timeout'] = $value;
}
}
private function add_verify(RequestInterface $request, &$options, $value, &$params)
private function add_verify(?RequestInterface $request, &$options, $value, &$params)
{
if ($value === true) {
if (PHP_VERSION_ID < 50600) {
@@ -415,7 +415,7 @@ class SdkStreamHandler
$options['ssl']['allow_self_signed'] = false;
}
private function add_cert(RequestInterface $request, &$options, $value, &$params)
private function add_cert(?RequestInterface $request, &$options, $value, &$params)
{
if (is_array($value)) {
$options['ssl']['passphrase'] = $value[1];
@@ -429,7 +429,7 @@ class SdkStreamHandler
$options['ssl']['local_cert'] = $value;
}
private function add_progress(RequestInterface $request, &$options, $value, &$params)
private function add_progress(?RequestInterface $request, &$options, $value, &$params)
{
$this->addNotification(
$params,
@@ -441,7 +441,7 @@ class SdkStreamHandler
);
}
private function add_debug(RequestInterface $request, &$options, $value, &$params)
private function add_debug(?RequestInterface $request, &$options, $value, &$params)
{
if ($value === false) {
return;
@@ -478,7 +478,7 @@ class SdkStreamHandler
);
}
private function addNotification(array &$params, callable $notify)
private function addNotification(?array &$params, callable $notify)
{
if (!isset($params['notification'])) {
$params['notification'] = $notify;
@@ -490,7 +490,7 @@ class SdkStreamHandler
}
}
private function callArray(array $functions)
private function callArray(?array $functions)
{
return function () use ($functions) {
$args = func_get_args();