Variable Checks¶
This pass performs syntactical variable checks:
function foo() {
echo $a; // $a was not defined.
}
function bar($artificial) {
if ($artifical) { // will suggest to rename to $artificial
// do something
}
}
It also performs a limited analysis to check that arrays have been initialized before they are written to:
function foo() {
$a[] = 'foo'; // will suggest to add $a = array(); before
}
At the moment, this does not perform a full-blown data flow analysis, so currently it will not catch things that only may be defined, like in this example:
function foo($a) {
if ($a || 'foo' === $b = some_function()) {
echo $b; // $b is not always defined
}
}