| 1 | <?php |
||
| 8 | class StaticPropertyFetch extends Expr |
||
| 9 | { |
||
| 10 | /** @var Name|Expr Class name */ |
||
| 11 | public $class; |
||
| 12 | /** @var string|Expr Property name */ |
||
| 13 | public $name; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Constructs a static property fetch node. |
||
| 17 | * |
||
| 18 | * @param Name|Expr $class Class name |
||
| 19 | * @param string|Expr $name Property name |
||
| 20 | * @param array $attributes Additional attributes |
||
| 21 | */ |
||
| 22 | public function __construct($class, $name, array $attributes = array()) { |
||
| 23 | parent::__construct($attributes); |
||
| 24 | $this->class = $class; |
||
|
|
|||
| 25 | $this->name = $name; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getSubNodeNames() { |
||
| 31 | } |
||
| 32 |
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
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. 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.