Skip to content

Commit 838e7a0

Browse files
authored
Avoid triggering Symfony HTTPlug Client exception (#170)
Avoid triggering Symfony HttpPlug Client exception
1 parent 27903aa commit 838e7a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Strategy/CommonClassesStrategy.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ public static function getCandidates($type)
112112

113113
// HTTPlug 2.0 clients implements PSR18Client too.
114114
foreach (self::$classes[HttpClient::class] as $c) {
115-
if (is_subclass_of($c['class'], Psr18Client::class)) {
116-
$candidates[] = $c;
115+
try {
116+
if (is_subclass_of($c['class'], Psr18Client::class)) {
117+
$candidates[] = $c;
118+
}
119+
} catch (\Throwable $e) {
120+
trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-18 Client is available', get_class($e), $e->getMessage()), E_USER_WARNING);
117121
}
118122
}
119123

0 commit comments

Comments
 (0)