1 | <?php |
||
19 | final class PluginClient implements HttpClient, HttpAsyncClient |
||
20 | { |
||
21 | /** |
||
22 | * An HTTP async client. |
||
23 | * |
||
24 | * @var HttpAsyncClient |
||
25 | */ |
||
26 | private $client; |
||
27 | |||
28 | /** |
||
29 | * The plugin chain. |
||
30 | * |
||
31 | * @var Plugin[] |
||
32 | */ |
||
33 | private $plugins; |
||
34 | |||
35 | /** |
||
36 | * A list of options. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | private $options; |
||
41 | |||
42 | /** |
||
43 | * @param HttpClient|HttpAsyncClient $client |
||
44 | * @param Plugin[] $plugins |
||
45 | * @param array $options { |
||
46 | * |
||
47 | * @var int $max_restarts |
||
48 | * @var Plugin[] $debug_plugins an array of plugins that are injected between all normal plugins |
||
49 | * } |
||
50 | * |
||
51 | * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient |
||
52 | */ |
||
53 | 8 | public function __construct($client, array $plugins = [], array $options = []) |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 4 | public function sendRequest(RequestInterface $request) |
|
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
101 | |||
102 | /** |
||
103 | * Configure the plugin client. |
||
104 | * |
||
105 | * @param array $options |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | 8 | private function configure(array $options = []) |
|
119 | |||
120 | /** |
||
121 | * Create the plugin chain. |
||
122 | * |
||
123 | * @param Plugin[] $pluginList A list of plugins |
||
124 | * @param callable $clientCallable Callable making the HTTP call |
||
125 | * |
||
126 | * @return callable |
||
127 | */ |
||
128 | 5 | private function createPluginChain($pluginList, callable $clientCallable) |
|
162 | } |
||
163 |
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: