Open
Description
function whileLooopAssignWithUndefinedShift() {
$suggestions = [];
while ($part = array_shift($parts)) { // undefined variable parts
$suggestions[] = $part;
}
return $suggestions;
}
$parts
is not marked as undefined. This is happening because array_shift
counts as an assignment... but clearly not all assignments should be counted as definitions if the expected variable is an array or object.
This may mean that we need to annotate all the pass-by-reference functions in both PHP and WordPress by what types of variables they expect. 😩