Skip to content

Commit eca88fc

Browse files
authored
PHP 8.1: Passing null to non-nullable internal function parameters is deprecated (#261)
1 parent 960c012 commit eca88fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ public function __construct(array $cosConfig) {
141141
$this->cosConfig['schema'] = isset($cosConfig['schema']) ? $cosConfig['schema'] : 'http';
142142
$this->cosConfig['region'] = isset($cosConfig['region']) ? region_map($cosConfig['region']) : null;
143143
$this->cosConfig['appId'] = isset($cosConfig['credentials']['appId']) ? $cosConfig['credentials']['appId'] : null;
144-
$this->cosConfig['secretId'] = isset($cosConfig['credentials']['secretId']) ? $cosConfig['credentials']['secretId'] : '';
145-
$this->cosConfig['secretKey'] = isset($cosConfig['credentials']['secretKey']) ? $cosConfig['credentials']['secretKey'] : '';
144+
$this->cosConfig['secretId'] = isset($cosConfig['credentials']['secretId']) ? trim($cosConfig['credentials']['secretId']) : '';
145+
$this->cosConfig['secretKey'] = isset($cosConfig['credentials']['secretKey']) ? trim($cosConfig['credentials']['secretKey']) : '';
146146
$this->cosConfig['anonymous'] = isset($cosConfig['credentials']['anonymous']) ? $cosConfig['credentials']['anonymous'] : false;
147-
$this->cosConfig['token'] = isset($cosConfig['credentials']['token']) ? $cosConfig['credentials']['token'] : null;
147+
$this->cosConfig['token'] = isset($cosConfig['credentials']['token']) ? trim($cosConfig['credentials']['token']) : null;
148148
$this->cosConfig['timeout'] = isset($cosConfig['timeout']) ? $cosConfig['timeout'] : 3600;
149149
$this->cosConfig['connect_timeout'] = isset($cosConfig['connect_timeout']) ? $cosConfig['connect_timeout'] : 3600;
150150
$this->cosConfig['ip'] = isset($cosConfig['ip']) ? $cosConfig['ip'] : null;
@@ -177,7 +177,7 @@ public function __construct(array $cosConfig) {
177177
}));
178178
}
179179
$handler->push($this::handleErrors());
180-
$this->signature = new Signature(trim($this->cosConfig['secretId']), trim($this->cosConfig['secretKey']), $this->cosConfig, trim($this->cosConfig['token'] ));
180+
$this->signature = new Signature($this->cosConfig['secretId'], $this->cosConfig['secretKey'], $this->cosConfig, $this->cosConfig['token']);
181181
$area = $this->cosConfig['allow_accelerate'] ? 'accelerate' : $this->cosConfig['region'];
182182
$this->httpClient = new HttpClient([
183183
'base_uri' => $this->cosConfig['schema'].'://cos.' . $area . '.myqcloud.com/',

0 commit comments

Comments
 (0)