Skip to content

Commit fd3997f

Browse files
authored
fixing some psalm 5 complaints (#1110)
Whilst investigating upgrading to psalm 5, I notice that it generates a lot of new complaints. This fixes the ones that looked legit and require an API change, or were trivial. Does not upgrade to psalm 5 yet, though. That's a bigger job for another day.
1 parent f06afb7 commit fd3997f

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

Common/Adapter/HttpDiscovery/DependencyResolver.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ public function resolveUriFactory(): UriFactoryInterface
7171
return $this->messageFactoryResolver->resolveUriFactory();
7272
}
7373

74-
public function resolveHttpClient(): ClientInterface
75-
{
76-
return $this->psrClientResolver->resolvePsrClient();
77-
}
78-
7974
public function resolveHttpPlugAsyncClient(): HttpAsyncClient
8075
{
8176
return $this->httpPlugClientResolver->resolveHttpPlugAsyncClient();

Common/Export/Http/PsrTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function create(
5757
$endpoint,
5858
$contentType,
5959
$headers,
60-
(array) $compression,
60+
PsrUtils::compression($compression),
6161
$retryDelay,
6262
$maxRetries,
6363
);

Common/Export/Http/PsrUtils.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@ public static function decode(string $value, array $encodings): string
104104
return $value;
105105
}
106106

107+
/**
108+
* Resolve an array or CSV of compression types to a list
109+
*/
110+
public static function compression($compression): array
111+
{
112+
if (is_array($compression)) {
113+
return $compression;
114+
}
115+
if (!$compression) {
116+
return [];
117+
}
118+
if (strpos($compression, ',') === false) {
119+
return [$compression];
120+
}
121+
122+
return array_map('trim', explode(',', $compression));
123+
}
124+
107125
private static function encoder(string $encoding): ?callable
108126
{
109127
static $encoders;

0 commit comments

Comments
 (0)