Conditions | 3 |
Paths | 2 |
Total Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function __construct($redis, string $key = 'hermes_restart') |
||
23 | { |
||
24 | if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { |
||
25 | throw new InvalidArgumentException('Predis\Client or Redis instance required'); |
||
26 | } |
||
27 | |||
28 | $this->key = $key; |
||
29 | $this->redis = $redis; |
||
30 | } |
||
31 | |||
63 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: