Skip to content

Commit

Permalink
Revert #10039 and fix type and test
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Feb 19, 2024
1 parent f035c00 commit 4ac1872
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/Psalm/Internal/Type/TypeCombiner.php
Expand Up @@ -1047,12 +1047,19 @@ private static function scrapeStringProperties(
&& strtolower($type->value) === $type->value
) {
// do nothing
} elseif (isset($combination->value_types['string'])
&& $combination->value_types['string'] instanceof TNonFalsyString
&& $type->value
) {
// do nothing
} elseif (isset($combination->value_types['string'])
&& $combination->value_types['string'] instanceof TNonFalsyString
&& $type->value === '0'
) {
$combination->value_types['string'] = new TNonEmptyString();
} elseif (isset($combination->value_types['string'])
&& $combination->value_types['string'] instanceof TNonEmptyString
&& ($combination->value_types['string'] instanceof TNonFalsyString
? $type->value
: $type->value !== ''
)
&& $type->value !== ''
) {
// do nothing
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeCombinationTest.php
Expand Up @@ -934,7 +934,7 @@ public function providerTestValidTypeCombination(): array
],
],
'nonFalsyStringAndFalsyLiteral' => [
'string',
'non-empty-string',
[
'non-falsy-string',
'"0"',
Expand Down

0 comments on commit 4ac1872

Please sign in to comment.