Conditions | 7 |
Paths | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
23 | 34 | public function __construct($client) |
|
24 | { |
||
25 | 34 | if (!($client instanceof HttpClient) && !($client instanceof HttpAsyncClient) && !($client instanceof ClientInterface)) { |
|
|
|||
26 | 1 | throw new \LogicException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient'); |
|
27 | } |
||
28 | |||
29 | 33 | $this->httpClient = $client; |
|
30 | 33 | $this->httpAsyncClient = $client; |
|
31 | |||
32 | 33 | if (!($this->httpClient instanceof HttpClient) && !($client instanceof ClientInterface)) { |
|
33 | 11 | $this->httpClient = new EmulatedHttpClient($this->httpClient); |
|
34 | } |
||
35 | |||
36 | 33 | if (!($this->httpAsyncClient instanceof HttpAsyncClient)) { |
|
37 | 21 | $this->httpAsyncClient = new EmulatedHttpAsyncClient($this->httpAsyncClient); |
|
38 | } |
||
39 | 33 | } |
|
40 | } |
||
41 |
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.