1
0
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:
Daniil Gentili 2023-07-24 09:07:46 +02:00
parent 9c814c8a69
commit dfbc9dd177
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 7 additions and 5 deletions

View File

@ -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();
} }

View File

@ -860,6 +860,13 @@ class TypeCombinationTest extends TestCase
'non-empty-literal-string', 'non-empty-literal-string',
], ],
], ],
'nonFalsyStringAndFalsyLiteral' => [
'string',
[
'non-falsy-string',
'"0"',
],
],
]; ];
} }