1 | <?php |
||
9 | class CountryFactory |
||
10 | { |
||
11 | /** |
||
12 | * @var CountryRepository $countryRepository |
||
13 | */ |
||
14 | private $countryRepository; |
||
15 | |||
16 | 1 | private function __construct() |
|
19 | |||
20 | private function __clone() |
||
23 | |||
24 | /** |
||
25 | * @param string $id |
||
26 | * @return Country |
||
27 | */ |
||
28 | 3 | public static function generate(string $id): Country |
|
41 | |||
42 | /** |
||
43 | * @param CountryRepository $countryRepository |
||
44 | */ |
||
45 | public function setCountryRepository(CountryRepository $countryRepository): void |
||
49 | } |
||
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: