修复华为云存储报错

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

@@ -41,7 +41,7 @@ class SdkCurlFactory implements CurlFactoryInterface
$this->maxHandles = $maxHandles;
}
public function create(RequestInterface $request, array $options): EasyHandle
public function create(?RequestInterface $request, ?array $options): EasyHandle
{
if (isset($options['curl']['body_as_string'])) {
$options['_body_as_string'] = $options['curl']['body_as_string'];
@@ -85,7 +85,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
}
public function release(EasyHandle $easy): void
public function release(?EasyHandle $easy): void
{
$resource = $easy->handle;
unset($easy->handle);
@@ -102,7 +102,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
}
private function getDefaultConf(EasyHandle $easy)
private function getDefaultConf(?EasyHandle $easy)
{
$conf = [
'_headers' => $easy->request->getHeaders(),
@@ -129,7 +129,7 @@ class SdkCurlFactory implements CurlFactoryInterface
return $conf;
}
private function applyMethod(EasyHandle $easy, array &$conf)
private function applyMethod(?EasyHandle $easy, ?array &$conf)
{
$body = $easy->request->getBody();
$size = $body->getSize();
@@ -155,7 +155,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
}
private function applyBody(RequestInterface $request, array $options, array &$conf)
private function applyBody(?RequestInterface $request, ?array $options, ?array &$conf)
{
$size = $request->hasHeader('Content-Length')
? (int) $request->getHeaderLine('Content-Length')
@@ -209,7 +209,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
}
private function applyHeaders(EasyHandle $easy, array &$conf)
private function applyHeaders(?EasyHandle $easy, ?array &$conf)
{
foreach ($conf['_headers'] as $name => $values) {
foreach ($values as $value) {
@@ -223,7 +223,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
}
private function removeHeader($name, array &$options)
private function removeHeader($name, ?array &$options)
{
foreach (array_keys($options['_headers']) as $key) {
if (!strcasecmp($key, $name)) {
@@ -233,7 +233,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
}
private function applyHandlerOptions(EasyHandle $easy, array &$conf)
private function applyHandlerOptions(?EasyHandle $easy, ?array &$conf)
{
$options = $easy->options;
if (isset($options['verify'])) {
@@ -381,7 +381,7 @@ class SdkCurlFactory implements CurlFactoryInterface
}
private function createHeaderFn(EasyHandle $easy)
private function createHeaderFn(?EasyHandle $easy)
{
if (isset($easy->options['on_headers'])) {
$onHeaders = $easy->options['on_headers'];