These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Http\Client\Common; |
||
4 | |||
5 | use Http\Client\HttpAsyncClient; |
||
6 | use Http\Client\HttpClient; |
||
7 | use Psr\Http\Client\ClientInterface; |
||
8 | |||
9 | /** |
||
10 | * Emulates an async HTTP client. |
||
11 | * |
||
12 | * This should be replaced by an anonymous class in PHP 7. |
||
13 | * |
||
14 | * @author Márk Sági-Kazár <[email protected]> |
||
15 | */ |
||
16 | class EmulatedHttpAsyncClient implements HttpClient, HttpAsyncClient |
||
17 | { |
||
18 | use HttpAsyncClientEmulator; |
||
19 | use HttpClientDecorator; |
||
20 | |||
21 | /** |
||
22 | * @param HttpClient|ClientInterface $httpClient |
||
23 | */ |
||
24 | 35 | public function __construct($httpClient) |
|
25 | { |
||
26 | 35 | if (!($httpClient instanceof HttpClient) && !($httpClient instanceof ClientInterface)) { |
|
0 ignored issues
–
show
|
|||
27 | throw new \LogicException('Client must be an instance of Http\\Client\\HttpClient or Psr\\Http\\Client\\ClientInterface'); |
||
28 | } |
||
29 | |||
30 | 35 | $this->httpClient = $httpClient; |
|
31 | 35 | } |
|
32 | } |
||
33 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.