Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2.0116 |
Changes | 0 |
1 | <?php |
||
28 | 3 | public static function generate(string $id): Country |
|
29 | { |
||
30 | 3 | static $inst = null; |
|
31 | |||
32 | 3 | if ($inst === null) { |
|
33 | 1 | $inst = new CountryFactory(); |
|
34 | 1 | $inst->countryRepository = new CountryRepository(); |
|
35 | } |
||
36 | |||
37 | 3 | $data = $inst->countryRepository->findCountryByIsoCode($id); |
|
38 | |||
39 | return $inst->countryRepository->createFromArray($data); |
||
|
|||
40 | } |
||
41 | |||
50 |
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: