1 | <?php |
||
11 | class RemoveTranslationsForLocale extends Command |
||
12 | { |
||
13 | /** |
||
14 | * The name and signature of the console command. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $signature = 'trans-db:remove {locale}'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'Removes the translations from the DB for a given locale'; |
||
26 | |||
27 | /** |
||
28 | * Translation repository. |
||
29 | * |
||
30 | * @var TranslationRepository |
||
31 | */ |
||
32 | protected $translationRepository; |
||
33 | |||
34 | /** |
||
35 | * Locale. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $locale; |
||
40 | |||
41 | /** |
||
42 | * Create a new command instance. |
||
43 | * |
||
44 | * @param TranslationRepository $translationRepository |
||
45 | */ |
||
46 | public function __construct(TranslationRepository $translationRepository) |
||
51 | |||
52 | /** |
||
53 | * Execute the console command. |
||
54 | */ |
||
55 | public function handle() |
||
65 | |||
66 | /** |
||
67 | * Process the language lines to remove the specified locale. |
||
68 | * |
||
69 | * @param $lines |
||
70 | */ |
||
71 | protected function processLines($lines) |
||
78 | } |
||
79 |
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.