1 | <?php |
||
19 | class PluginClient implements HttpClient, HttpAsyncClient |
||
20 | { |
||
21 | /** |
||
22 | * An HTTP async client. |
||
23 | * |
||
24 | * @var HttpAsyncClient |
||
25 | */ |
||
26 | protected $client; |
||
27 | |||
28 | /** |
||
29 | * The plugin chain. |
||
30 | * |
||
31 | * @var Plugin[] |
||
32 | */ |
||
33 | protected $plugins; |
||
34 | |||
35 | /** |
||
36 | * A list of options. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $options; |
||
41 | |||
42 | /** |
||
43 | * @param HttpClient|HttpAsyncClient $client |
||
44 | * @param Plugin[] $plugins |
||
45 | * @param array $options |
||
46 | * |
||
47 | * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient |
||
48 | */ |
||
49 | 8 | public function __construct($client, array $plugins = [], array $options = []) |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 4 | public function sendRequest(RequestInterface $request) |
|
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
96 | |||
97 | /** |
||
98 | * Configure the plugin client. |
||
99 | * |
||
100 | * @param array $options |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | 8 | protected function configure(array $options = []) |
|
113 | |||
114 | /** |
||
115 | * Create the plugin chain. |
||
116 | * |
||
117 | * @param Plugin[] $pluginList A list of plugins |
||
118 | * @param callable $clientCallable Callable making the HTTP call |
||
119 | * |
||
120 | * @return callable |
||
121 | */ |
||
122 | 5 | private function createPluginChain($pluginList, callable $clientCallable) |
|
148 | } |
||
149 |
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: