1 | <?php |
||
22 | final class PluginClient implements HttpClient, HttpAsyncClient |
||
23 | { |
||
24 | /** |
||
25 | * An HTTP async client. |
||
26 | * |
||
27 | * @var HttpAsyncClient|HttpClient |
||
28 | */ |
||
29 | private $client; |
||
30 | |||
31 | /** |
||
32 | * The plugin chain. |
||
33 | * |
||
34 | * @var Plugin[] |
||
35 | */ |
||
36 | private $plugins; |
||
37 | |||
38 | /** |
||
39 | * A list of options. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | private $options; |
||
44 | |||
45 | /** |
||
46 | * @param ClientInterface|HttpAsyncClient $client An HTTP async client |
||
47 | * @param Plugin[] $plugins A plugin chain |
||
48 | * @param array $options { |
||
49 | * |
||
50 | * @var int $max_restarts |
||
51 | * } |
||
52 | */ |
||
53 | 10 | public function __construct($client, array $plugins = [], array $options = []) |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 4 | public function sendRequest(RequestInterface $request): ResponseInterface |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 2 | public function sendAsyncRequest(RequestInterface $request) |
|
103 | |||
104 | /** |
||
105 | * Configure the plugin client. |
||
106 | */ |
||
107 | 10 | private function configure(array $options = []): array |
|
118 | |||
119 | /** |
||
120 | * Create the plugin chain. |
||
121 | * |
||
122 | * @param Plugin[] $plugins A plugin chain |
||
123 | * @param callable $clientCallable Callable making the HTTP call |
||
124 | */ |
||
125 | 5 | private function createPluginChain(array $plugins, callable $clientCallable): callable |
|
129 | } |
||
130 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.