Skip to content

Commit af295dd

Browse files
committed
Leverage non-capturing catches
1 parent 9e8dfa1 commit af295dd

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ private static function createRedirectResolver(array $options, string $host, int
406406
return static function ($ch, string $location) use ($redirectHeaders) {
407407
try {
408408
$location = self::parseUrl($location);
409-
} catch (InvalidArgumentException $e) {
409+
} catch (InvalidArgumentException) {
410410
return null;
411411
}
412412

EventSourceHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function request(string $method, string $url, array $options = []): Respo
8484

8585
return;
8686
}
87-
} catch (TransportExceptionInterface $e) {
87+
} catch (TransportExceptionInterface) {
8888
$state->lastError = $lastError ?? microtime(true);
8989

9090
if (null === $state->buffer || ($isTimeout && microtime(true) - $state->lastError < $state->reconnectionTime)) {

NativeHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ private static function createRedirectResolver(array $options, string $host, str
367367

368368
try {
369369
$url = self::parseUrl($location);
370-
} catch (InvalidArgumentException $e) {
370+
} catch (InvalidArgumentException) {
371371
$info['redirect_url'] = null;
372372

373373
return null;

Response/AmpResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private static function followRedirects(Request $originRequest, AmpClientState $
313313
$location = $urlResolver::parseUrl($location);
314314
$location = $urlResolver::resolveUrl($location, $previousUrl);
315315
$info['redirect_url'] = implode('', $location);
316-
} catch (InvalidArgumentException $e) {
316+
} catch (InvalidArgumentException) {
317317
return $response;
318318
}
319319

@@ -327,7 +327,7 @@ private static function followRedirects(Request $originRequest, AmpClientState $
327327
// Discard body of redirects
328328
while (null !== yield $response->getBody()->read()) {
329329
}
330-
} catch (HttpException|StreamException $e) {
330+
} catch (HttpException|StreamException) {
331331
// Ignore streaming errors on previous responses
332332
}
333333

Response/AsyncResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function cancel(): void
168168
}
169169

170170
$this->passthru = null;
171-
} catch (ExceptionInterface $e) {
171+
} catch (ExceptionInterface) {
172172
// ignore any errors when canceling
173173
}
174174
}
@@ -193,7 +193,7 @@ public function __destruct()
193193
foreach (self::passthru($this->client, $this, new LastChunk()) as $chunk) {
194194
// no-op
195195
}
196-
} catch (ExceptionInterface $e) {
196+
} catch (ExceptionInterface) {
197197
// ignore any errors when destructing
198198
}
199199
}

0 commit comments

Comments
 (0)