Skip to content

Commit ae6ebfe

Browse files
author
Kyra Farrow
committed
[HttpClient] add missing argument check
1 parent 03843d3 commit ae6ebfe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ScopingHttpClient.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function __construct(HttpClientInterface $client, array $defaultOptionsBy
3636
$this->client = $client;
3737
$this->defaultOptionsByRegexp = $defaultOptionsByRegexp;
3838
$this->defaultRegexp = $defaultRegexp;
39+
40+
if (null !== $defaultRegexp && !isset($defaultOptionsByRegexp[$defaultRegexp])) {
41+
throw new InvalidArgumentException(sprintf('No options are mapped to the provided "%s" default regexp.', $defaultRegexp));
42+
}
3943
}
4044

4145
public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], $regexp = null): self

0 commit comments

Comments
 (0)