1 | <?php |
||
21 | /*final*/ class PluginClient implements HttpClient, HttpAsyncClient |
||
22 | { |
||
23 | /** |
||
24 | * An HTTP async client. |
||
25 | * |
||
26 | * @var HttpAsyncClient |
||
27 | */ |
||
28 | private $client; |
||
29 | |||
30 | /** |
||
31 | * The plugin chain. |
||
32 | * |
||
33 | * @var Plugin[] |
||
34 | */ |
||
35 | private $plugins; |
||
36 | |||
37 | /** |
||
38 | * A list of options. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | private $options; |
||
43 | |||
44 | /** |
||
45 | * @param HttpClient|HttpAsyncClient $client |
||
46 | * @param Plugin[] $plugins |
||
47 | * @param array $options { |
||
48 | * |
||
49 | * @var int $max_restarts |
||
50 | * } |
||
51 | * |
||
52 | * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient |
||
53 | */ |
||
54 | 8 | public function __construct($client, array $plugins = [], array $options = []) |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 4 | public function sendRequest(RequestInterface $request) |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
102 | |||
103 | /** |
||
104 | * Configure the plugin client. |
||
105 | * |
||
106 | * @param array $options |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | 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) |
|
153 | |||
154 | /** |
||
155 | * Creates a new loop exception. |
||
156 | * |
||
157 | * @param RequestInterface $request |
||
158 | * |
||
159 | * @return LoopException |
||
160 | * |
||
161 | * TODO: Remove once plugin client is removed from plugins. |
||
162 | */ |
||
163 | 1 | protected function createLoopException(RequestInterface $request) |
|
167 | } |
||
168 |
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: