1 | <?php |
||
20 | class SearchWidget extends BaseWidget |
||
21 | { |
||
22 | /** |
||
23 | * @var string Path of the search form. If there is a file search-form.php in directory 'layouts' of active theme, |
||
24 | * the widget uses it, but if not, the widget uses search-form.php that exist in the directory 'views'. |
||
25 | */ |
||
26 | private $_searchForm; |
||
27 | |||
28 | /** |
||
29 | * @inheritdoc |
||
30 | */ |
||
31 | public function init() |
||
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | */ |
||
48 | public function run() |
||
59 | } |
||
60 |
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.