mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix combination of non-falsy-string and falsy literal
This commit is contained in:
parent
9c814c8a69
commit
dfbc9dd177
@ -1038,11 +1038,6 @@ class TypeCombiner
|
|||||||
&& $type->value
|
&& $type->value
|
||||||
) {
|
) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} elseif (isset($combination->value_types['string'])
|
|
||||||
&& $combination->value_types['string'] instanceof TNonEmptyString
|
|
||||||
&& $type->value !== ''
|
|
||||||
) {
|
|
||||||
// do nothing
|
|
||||||
} else {
|
} else {
|
||||||
$combination->value_types['string'] = new TString();
|
$combination->value_types['string'] = new TString();
|
||||||
}
|
}
|
||||||
|
@ -860,6 +860,13 @@ class TypeCombinationTest extends TestCase
|
|||||||
'non-empty-literal-string',
|
'non-empty-literal-string',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'nonFalsyStringAndFalsyLiteral' => [
|
||||||
|
'string',
|
||||||
|
[
|
||||||
|
'non-falsy-string',
|
||||||
|
'"0"',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user