Skip to content

Commit

Permalink
Fix combination of non-falsy-string and falsy literal
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jul 24, 2023
1 parent 9c814c8 commit dfbc9dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/Psalm/Internal/Type/TypeCombiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -1038,11 +1038,6 @@ private static function scrapeStringProperties(
&& $type->value
) {
// do nothing
} elseif (isset($combination->value_types['string'])
&& $combination->value_types['string'] instanceof TNonEmptyString
&& $type->value !== ''
) {
// do nothing
} else {
$combination->value_types['string'] = new TString();
}
Expand Down
7 changes: 7 additions & 0 deletions tests/TypeCombinationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,13 @@ public function providerTestValidTypeCombination(): array
'non-empty-literal-string',
],
],
'nonFalsyStringAndFalsyLiteral' => [
'string',
[
'non-falsy-string',
'"0"',
],
],
];
}

Expand Down

0 comments on commit dfbc9dd

Please sign in to comment.