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

Allow union with positive-int

This commit is contained in:
Matt Brown 2020-10-16 18:02:43 -04:00
parent be1cd5275e
commit 5dab45ce14
2 changed files with 3 additions and 2 deletions

View File

@ -44,6 +44,6 @@ class TLiteralInt extends TInt
?string $this_class,
bool $use_phpdoc_format
): string {
return $use_phpdoc_format ? 'int' : $this->value;
return $use_phpdoc_format ? 'int' : (string) $this->value;
}
}

View File

@ -404,7 +404,8 @@ class Union implements TypeNode
): string {
$types = [];
$multi_ints = count($this->literal_int_types) > 1;
$multi_ints = count($this->literal_int_types) > 1
|| $this->hasPositiveInt();
$multi_strings = count($this->literal_string_types) > 1;
$multi_floats = count($this->literal_float_types) > 1;