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