1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +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();
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) {