| Conditions | 3 |
| Paths | 3 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | public function findCountryBy(string $key, string $value): Country |
||
| 50 | { |
||
| 51 | foreach ($this->countries as $country) { |
||
| 52 | if ($country[$key] === $value) { |
||
| 53 | return $this->createFromArray($this->countries[$id]); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | throw new CountryException(CountryException::ERROR_NOT_FOUND); |
||
| 58 | } |
||
| 59 | |||
| 76 | } |
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: