1 | <?php |
||
13 | class HttpClientRouter implements HttpClient, HttpAsyncClient |
||
14 | { |
||
15 | private $clients = []; |
||
16 | |||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | 2 | public function sendRequest(RequestInterface $request) |
|
36 | |||
37 | /** |
||
38 | * Add a client to the router |
||
39 | * |
||
40 | * @param HttpClient|HttpAsyncClient $client |
||
41 | * @param RequestMatcher $requestMatcher |
||
42 | */ |
||
43 | 4 | public function addClient($client, RequestMatcher $requestMatcher) |
|
50 | |||
51 | /** |
||
52 | * Choose a http client given a specific request |
||
53 | * |
||
54 | * @param RequestInterface $request |
||
55 | * |
||
56 | * @return HttpClient|HttpAsyncClient |
||
57 | */ |
||
58 | 4 | protected function chooseHttpClient(RequestInterface $request) |
|
68 | } |
||
69 |
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: