Skip to content

Commit

Permalink
should be non-falsy-string instead of non-empty-string in most cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Dec 20, 2023
1 parent b2ed36e commit 6d35341
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Psalm/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public static function getString(?string $value = null): Union
return new Union([$value === null ? new TString() : self::getAtomicStringFromLiteral($value)]);
}

/** @return TLiteralString|TNonEmptyString */
/** @return TLiteralString|TNonEmptyString|TNonFalsyString */
public static function getAtomicStringFromLiteral(string $value, bool $from_docblock = false): TString
{
$config = Config::getInstance();
Expand All @@ -289,8 +289,10 @@ public static function getAtomicStringFromLiteral(string $value, bool $from_docb
if (!$type) {
if ($value === '' || strlen($value) < $config->max_string_length) {
$type = new TLiteralString($value, $from_docblock);
} else {
} elseif ($value === '0') {
$type = new TNonEmptyString($from_docblock);
} else {
$type = new TNonFalsyString($from_docblock);
}
}

Expand Down

0 comments on commit 6d35341

Please sign in to comment.