1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Fix empty literal string becomes non-empty-string

when max literal string length is 0, which means literal strings are disabled
This commit is contained in:
kkmuffme 2023-12-17 20:31:32 +01:00
parent 079bfb837c
commit a2bf5cb054

View File

@ -287,7 +287,7 @@ abstract class Type
$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);