1 | <?php |
||
5 | class LogicOpNode |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var LogicOpNode|null |
||
10 | */ |
||
11 | private $parent; |
||
12 | |||
13 | /** |
||
14 | * @var bool |
||
15 | */ |
||
16 | private $value; |
||
17 | |||
18 | /** |
||
19 | * @var LogicOpNode[] |
||
20 | */ |
||
21 | private $children = []; |
||
22 | |||
23 | /** |
||
24 | * MASTNode constructor. |
||
25 | * @param self|null $parent |
||
26 | * @param bool|null $value |
||
27 | */ |
||
28 | public function __construct(self $parent = null, $value = null) |
||
33 | |||
34 | /** |
||
35 | * @return array |
||
36 | */ |
||
37 | public function flags() |
||
54 | |||
55 | /** |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function isRoot() |
||
62 | |||
63 | /** |
||
64 | * @return LogicOpNode|null |
||
65 | */ |
||
66 | public function getParent() |
||
70 | |||
71 | /** |
||
72 | * @return bool|null |
||
73 | */ |
||
74 | public function getValue() |
||
78 | |||
79 | /** |
||
80 | * @param $value |
||
81 | * @return LogicOpNode |
||
82 | */ |
||
83 | public function getChild($value) |
||
90 | |||
91 | /** |
||
92 | * @return array |
||
93 | */ |
||
94 | public function split() |
||
106 | } |
||
107 |
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.