1 | #!/usr/bin/php |
||
14 | class IndexerCLI extends CLI { |
||
15 | |||
16 | private $quiet = false; |
||
17 | private $clear = false; |
||
18 | |||
19 | /** |
||
20 | * Register options and arguments on the given $options object |
||
21 | * |
||
22 | * @param Options $options |
||
23 | * @return void |
||
24 | */ |
||
25 | protected function setup(Options $options) { |
||
42 | |||
43 | /** |
||
44 | * Your main program |
||
45 | * |
||
46 | * Arguments and options have been parsed when this is run |
||
47 | * |
||
48 | * @param Options $options |
||
49 | * @return void |
||
50 | */ |
||
51 | protected function main(Options $options) { |
||
59 | |||
60 | /** |
||
61 | * Update the index |
||
62 | */ |
||
63 | function update() { |
||
74 | |||
75 | /** |
||
76 | * Index the given page |
||
77 | * |
||
78 | * @param string $id |
||
79 | */ |
||
80 | function index($id) { |
||
85 | |||
86 | /** |
||
87 | * Clear all index files |
||
88 | */ |
||
89 | function clearindex() { |
||
94 | |||
95 | /** |
||
96 | * Print message if not supressed |
||
97 | * |
||
98 | * @param string $msg |
||
99 | */ |
||
100 | function quietecho($msg) { |
||
103 | } |
||
104 | |||
108 |
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.