1 | <?php |
||
9 | class CountryRepository |
||
10 | { |
||
11 | /** @var Country[] $countries */ |
||
12 | private $countries; |
||
13 | |||
14 | /** |
||
15 | * CountryRepository constructor. |
||
16 | */ |
||
17 | 1 | public function __construct() |
|
22 | |||
23 | /** |
||
24 | * @return Country[] |
||
25 | */ |
||
26 | public function findAllCountries(): array |
||
36 | |||
37 | /** |
||
38 | * @param string $id |
||
39 | * @return Country |
||
40 | * @throws CountryException |
||
41 | */ |
||
42 | 3 | public function findCountryByIsoCode(string $id): Country |
|
50 | |||
51 | /** |
||
52 | * @param string $id |
||
53 | * @return Country |
||
54 | * @throws CountryException |
||
55 | */ |
||
56 | public function findCountryBy(string $key, string $value): Country |
||
66 | |||
67 | /** |
||
68 | * @param array $data |
||
69 | * @return Country |
||
70 | */ |
||
71 | 2 | public function createFromArray(array $data): Country |
|
82 | } |
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: