1 | <?php |
||
9 | class LocalesAreInstalled implements Check |
||
10 | { |
||
11 | /** @var Collection */ |
||
12 | protected $missingLocales; |
||
13 | |||
14 | /** @var string|null */ |
||
15 | protected $message; |
||
16 | |||
17 | /** @var SystemFunctions */ |
||
18 | protected $systemFunctions; |
||
19 | |||
20 | /** |
||
21 | * LocalesAreInstalled constructor. |
||
22 | * |
||
23 | * @param SystemFunctions $systemFunctions |
||
24 | */ |
||
25 | 24 | public function __construct(SystemFunctions $systemFunctions) |
|
26 | { |
||
27 | 24 | $this->systemFunctions = $systemFunctions; |
|
28 | 24 | } |
|
29 | |||
30 | /** |
||
31 | * The name of the check. |
||
32 | * |
||
33 | * @param array $config |
||
34 | * @return string |
||
35 | */ |
||
36 | public function name(array $config): string |
||
37 | { |
||
38 | return trans('self-diagnosis::checks.locales_are_installed.name'); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Perform the actual verification of this check. |
||
43 | * |
||
44 | * @param array $config |
||
45 | * @return bool |
||
46 | */ |
||
47 | 24 | public function check(array $config): bool |
|
78 | |||
79 | /** |
||
80 | * The error message to display in case the check does not pass. |
||
81 | * |
||
82 | * @param array $config |
||
83 | * @return string |
||
84 | */ |
||
85 | 16 | public function message(array $config): string |
|
95 | } |
||
96 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.