noverify
noverify copied to clipboard
Type inference in `!instanceof T || <use as T>`
Code Example
public function isEmpty($value, $trim = false)
{
$value = is_array($value) ? reset($value) : $value;
return !($value instanceof UploadedFile) || $value->error == UPLOAD_ERR_NO_FILE;
}
Actual Behavior
NoVerify gives undefined
error for error
property.
Expected Behavior
Type of $value
is inferred as UploadedFile
, since conditional expression checks for that.
Note: PhpStorm understands it.
Also:
<critical> ERROR undefined: Call to undefined method {\phpDocumentor\Reflection\Type}->getFqsen() at /home/isharipov/CODE/php/basic/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:398
&& (!$classType instanceof Object_ || $classType->getFqsen() === null)) {