Skip to content

Commit af95756

Browse files
minor #42949 Remove needless TypeErrors (nicolas-grekas)
This PR was merged into the 6.0 branch. Discussion ---------- Remove needless TypeErrors | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- c7d479ea51 Remove needless TypeErrors
2 parents 2a207f9 + 1637a24 commit af95756

8 files changed

+0
-18
lines changed

AmpHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
149149
{
150150
if ($responses instanceof AmpResponse) {
151151
$responses = [$responses];
152-
} elseif (!is_iterable($responses)) {
153-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of AmpResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
154152
}
155153

156154
return new ResponseStream(AmpResponse::stream($responses, $timeout));

AsyncDecoratorTrait.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
3939
{
4040
if ($responses instanceof AsyncResponse) {
4141
$responses = [$responses];
42-
} elseif (!is_iterable($responses)) {
43-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of AsyncResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
4442
}
4543

4644
return new ResponseStream(AsyncResponse::stream($responses, $timeout, static::class));

CachingHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
113113
{
114114
if ($responses instanceof ResponseInterface) {
115115
$responses = [$responses];
116-
} elseif (!is_iterable($responses)) {
117-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of ResponseInterface objects, "%s" given.', __METHOD__, get_debug_type($responses)));
118116
}
119117

120118
$mockResponses = [];

CurlHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
327327
{
328328
if ($responses instanceof CurlResponse) {
329329
$responses = [$responses];
330-
} elseif (!is_iterable($responses)) {
331-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of CurlResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
332330
}
333331

334332
if ($this->multi->handle instanceof \CurlMultiHandle) {

MockHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
8585
{
8686
if ($responses instanceof ResponseInterface) {
8787
$responses = [$responses];
88-
} elseif (!is_iterable($responses)) {
89-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of MockResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
9088
}
9189

9290
return new ResponseStream(MockResponse::stream($responses, $timeout));

NativeHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
249249
{
250250
if ($responses instanceof NativeResponse) {
251251
$responses = [$responses];
252-
} elseif (!is_iterable($responses)) {
253-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of NativeResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
254252
}
255253

256254
return new ResponseStream(NativeResponse::stream($responses, $timeout));

NoPrivateNetworkHttpClient.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
5353
*/
5454
public function __construct(HttpClientInterface $client, string|array $subnets = null)
5555
{
56-
if (!(\is_array($subnets) || \is_string($subnets) || null === $subnets)) {
57-
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be of the type array, string or null. "%s" given.', __METHOD__, get_debug_type($subnets)));
58-
}
59-
6056
if (!class_exists(IpUtils::class)) {
6157
throw new \LogicException(sprintf('You can not use "%s" if the HttpFoundation component is not installed. Try running "composer require symfony/http-foundation".', __CLASS__));
6258
}

TraceableHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ public function stream(ResponseInterface|iterable $responses, float $timeout = n
7575
{
7676
if ($responses instanceof TraceableResponse) {
7777
$responses = [$responses];
78-
} elseif (!is_iterable($responses)) {
79-
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
8078
}
8179

8280
return new ResponseStream(TraceableResponse::stream($this->client, $responses, $timeout));

0 commit comments

Comments
 (0)