bug #31542 [HttpClient] add missing argument check (nicolas-grekas)
This PR was merged into the 4.3 branch.
Discussion
----------
[HttpClient] add missing argument check
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Should save some time, sometimes.
Commits
-------
964acd9110
[HttpClient] add missing argument check
This commit is contained in:
commit
b5dfbef3d1
@ -36,6 +36,10 @@ class ScopingHttpClient implements HttpClientInterface
|
|||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
$this->defaultOptionsByRegexp = $defaultOptionsByRegexp;
|
$this->defaultOptionsByRegexp = $defaultOptionsByRegexp;
|
||||||
$this->defaultRegexp = $defaultRegexp;
|
$this->defaultRegexp = $defaultRegexp;
|
||||||
|
|
||||||
|
if (null !== $defaultRegexp && !isset($defaultOptionsByRegexp[$defaultRegexp])) {
|
||||||
|
throw new InvalidArgumentException(sprintf('No options are mapped to the provided "%s" default regexp.', $defaultRegexp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], $regexp = null): self
|
public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], $regexp = null): self
|
||||||
|
Reference in New Issue
Block a user