mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Isset treated as !null
This commit is contained in:
parent
c9b5554b69
commit
39f459ac27
@ -217,6 +217,14 @@ class TypeChecker
|
||||
$var_name = $this->_getVariable($conditional->expr->args[0]->value);
|
||||
$if_types[$var_name] = '!array';
|
||||
}
|
||||
else if ($conditional->expr instanceof PhpParser\Node\Expr\Isset_) {
|
||||
foreach ($conditional->expr->vars as $isset_var) {
|
||||
$var_name = $this->_getVariable($isset_var);
|
||||
if ($var_name) {
|
||||
$if_types[$var_name] = '!null';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($conditional instanceof PhpParser\Node\Expr\BinaryOp\Identical || $conditional instanceof PhpParser\Node\Expr\BinaryOp\Equal) {
|
||||
$null_position = self::_hasNullVariable($conditional);
|
||||
@ -280,6 +288,14 @@ class TypeChecker
|
||||
$if_types[$var_name] = 'empty';
|
||||
}
|
||||
}
|
||||
else if ($conditional instanceof PhpParser\Node\Expr\Isset_) {
|
||||
foreach ($conditional->vars as $isset_var) {
|
||||
$var_name = $this->_getVariable($isset_var);
|
||||
if ($var_name) {
|
||||
$if_types[$var_name] = '!null';
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($conditional instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr) {
|
||||
$left_assertions = $this->getTypeAssertions($conditional->left, false);
|
||||
$right_assertions = $this->getTypeAssertions($conditional->right, false);
|
||||
|
Loading…
Reference in New Issue
Block a user