1 | <?php |
||
19 | final class HttpClientRouter implements HttpClientRouterInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $clients = []; |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | 2 | public function sendRequest(RequestInterface $request): ResponseInterface |
|
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
41 | |||
42 | /** |
||
43 | * Add a client to the router. |
||
44 | * |
||
45 | * @param ClientInterface|HttpAsyncClient $client |
||
46 | */ |
||
47 | 4 | public function addClient($client, RequestMatcher $requestMatcher): void |
|
60 | |||
61 | /** |
||
62 | * Choose an HTTP client given a specific request. |
||
63 | * |
||
64 | * @return ClientInterface|HttpAsyncClient |
||
65 | */ |
||
66 | 4 | private function chooseHttpClient(RequestInterface $request) |
|
76 | } |
||
77 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: