1 | <?php |
||
20 | class PluginClient implements HttpClient, HttpAsyncClient |
||
21 | { |
||
22 | /** |
||
23 | * An HTTP async client. |
||
24 | * |
||
25 | * @var HttpAsyncClient |
||
26 | */ |
||
27 | protected $client; |
||
28 | |||
29 | /** |
||
30 | * The plugin chain. |
||
31 | * |
||
32 | * @var Plugin[] |
||
33 | */ |
||
34 | protected $plugins; |
||
35 | |||
36 | /** |
||
37 | * A list of options. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $options; |
||
42 | |||
43 | /** |
||
44 | * @param HttpClient|HttpAsyncClient $client |
||
45 | * @param Plugin[] $plugins |
||
46 | * @param array $options |
||
47 | * |
||
48 | * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient |
||
49 | */ |
||
50 | 8 | public function __construct($client, array $plugins = [], array $options = []) |
|
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 4 | public function sendRequest(RequestInterface $request) |
|
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
100 | |||
101 | /** |
||
102 | * Configure the plugin client. |
||
103 | * |
||
104 | * @param array $options |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | 8 | protected function configure(array $options = []) |
|
117 | |||
118 | /** |
||
119 | * Create the plugin chain. |
||
120 | * |
||
121 | * @param Plugin[] $pluginList A list of plugins |
||
122 | * @param callable $clientCallable Callable making the HTTP call |
||
123 | * |
||
124 | * @return callable |
||
125 | */ |
||
126 | 5 | private function createPluginChain($pluginList, callable $clientCallable) |
|
152 | } |
||
153 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: