From a2bf5cb0546661bd8b058132b738a8798fc68959 Mon Sep 17 00:00:00 2001 From: kkmuffme <11071985+kkmuffme@users.noreply.github.com> Date: Sun, 17 Dec 2023 20:31:32 +0100 Subject: [PATCH] Fix empty literal string becomes non-empty-string when max literal string length is 0, which means literal strings are disabled --- src/Psalm/Type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 1215799f785..d05a9b9d5c3 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -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);