1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Support false and null unions in PHP 8 signatures

This commit is contained in:
Matt Brown 2020-10-14 15:24:37 -04:00
parent 62c15b2a4f
commit e29cbe368a

View File

@ -194,7 +194,11 @@ abstract class Atomic implements TypeNode
return $php_version !== null ? new TNamedObject($value) : new TTrue();
case 'false':
return $php_version !== null ? new TNamedObject($value) : new TFalse();
if ($php_version === null || $php_version[0] >= 8) {
return new TFalse();
}
return new TNamedObject($value);
case 'empty':
return $php_version !== null ? new TNamedObject($value) : new TEmpty();
@ -203,7 +207,11 @@ abstract class Atomic implements TypeNode
return $php_version !== null ? new TNamedObject($value) : new TScalar();
case 'null':
return $php_version !== null ? new TNamedObject($value) : new TNull();
if ($php_version === null || $php_version[0] >= 8) {
return new TNull();
}
return new TNamedObject($value);
case 'mixed':
if ($php_version === null || $php_version[0] >= 8) {