noverify
noverify copied to clipboard
False positive array access
Code Example
class Element {}
function f()
{
$result = [];
$returnArray = true;
$result[] = new Element();
return $returnArray ? $result : $result[0];
}
Actual Behavior
<critical> ERROR arrayAccess: Array access to non-array type \Element|\Element[] at C:/projects/noverify/example/index.php:14
return $returnArray ? $result : $result[0];
^^^^^^^
Expected Behavior
No warnings.