php: highlight as error when using the same variable name as class property name
Is there a setting that would highlight as error or make notice in some other way variable $i in the statement $i = $i + $num; in the below code? Because it has the same name as class property so it's most often unintentional and wrong. Should be $this->i
class My {
private $i = 0;
private add($num) {
$i = $i + $num;
}
}
The same for calling a method.
In this class, calling for example add(5) should be highlighted as error, because most probably the intention was to call $this->add(5)
[Edit]
Actually, I noticed that these errors are sometimes highlighted as errors and sometimes not. I wonder what it depends on.
Message was edited by: beamar
请先登录再写评论。