1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +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 committed by Daniil Gentili
parent 4acaf40f26
commit 66e40f1007
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

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