1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #6830 from orklah/isContainedBy

Mixed contain every types and Never is contained in every type
This commit is contained in:
orklah 2021-11-05 22:05:32 +01:00 committed by GitHub
commit aca8e12bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,14 @@ class UnionTypeComparator
bool $allow_interface_equality = false,
bool $allow_float_int_equality = true
) : bool {
if ($container_type->isMixed()) {
return true;
}
if ($input_type->isNever()) {
return true;
}
if ($union_comparison_result) {
$union_comparison_result->scalar_type_match_found = true;
}
@ -317,6 +325,10 @@ class UnionTypeComparator
return false;
}
if ($input_type->isNever()) {
return true;
}
if ($input_type->getId() === $container_type->getId()) {
return true;
}
@ -357,6 +369,10 @@ class UnionTypeComparator
return true;
}
if ($input_type->isNever()) {
return true;
}
if ($input_type->possibly_undefined && !$container_type->possibly_undefined) {
return false;
}