Skip to content

Commit

Permalink
Fix empty literal string becomes non-empty-string
Browse files Browse the repository at this point in the history
when max literal string length is 0, which means literal strings are disabled
  • Loading branch information
kkmuffme committed Jan 13, 2024
1 parent 079bfb8 commit a2bf5cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static function getAtomicStringFromLiteral(string $value, bool $from_docb
$type = $config->eventDispatcher->dispatchStringInterpreter($event);

if (!$type) {
if (strlen($value) < $config->max_string_length) {
if ($value === '' || strlen($value) < $config->max_string_length) {
$type = new TLiteralString($value, $from_docblock);
} else {
$type = new TNonEmptyString($from_docblock);
Expand Down

0 comments on commit a2bf5cb

Please sign in to comment.