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:
commit
aca8e12bf9
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user