Conditions | 6 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 9.1595 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
14 | 2 | public static function resolve(iterable $directories, ?string $cacheFile): iterable |
|
15 | { |
||
16 | 2 | if ($cacheFile !== null && \file_exists($cacheFile)) { |
|
17 | try { |
||
18 | return Cache::read($cacheFile); |
||
19 | } catch (\Throwable $et) { |
||
20 | // void |
||
21 | } |
||
22 | } |
||
23 | |||
24 | 2 | $commandToHandlerMap = self::gather($directories); |
|
25 | |||
26 | 2 | if ($cacheFile !== null && \is_dir(\dirname($cacheFile))) { |
|
27 | $commandToHandlerMap = iteratorOrArrayToArray($commandToHandlerMap); |
||
28 | Cache::write($cacheFile, $commandToHandlerMap); |
||
29 | } |
||
30 | |||
31 | 2 | return $commandToHandlerMap; |
|
32 | } |
||
33 | |||
54 |
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: