mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
parent
c2c2e26d6d
commit
b25f2e6921
@ -26,6 +26,7 @@ use Psalm\Type\Atomic\TMixed;
|
||||
use Psalm\Type\Atomic\TNamedObject;
|
||||
use Psalm\Type\Atomic\TNever;
|
||||
use Psalm\Type\Atomic\TNonEmptyArray;
|
||||
use Psalm\Type\Atomic\TNonEmptyMixed;
|
||||
use Psalm\Type\Atomic\TNull;
|
||||
use Psalm\Type\Atomic\TObject;
|
||||
use Psalm\Type\Atomic\TObjectWithProperties;
|
||||
@ -87,8 +88,11 @@ class AtomicTypeComparator
|
||||
&& !$container_type_part->extra_types
|
||||
&& $input_type_part instanceof TMixed)
|
||||
) {
|
||||
if (get_class($container_type_part) === TEmptyMixed::class
|
||||
&& get_class($input_type_part) === TMixed::class
|
||||
if (get_class($input_type_part) === TMixed::class
|
||||
&& (
|
||||
get_class($container_type_part) === TEmptyMixed::class
|
||||
|| get_class($container_type_part) === TNonEmptyMixed::class
|
||||
)
|
||||
) {
|
||||
if ($atomic_comparison_result) {
|
||||
$atomic_comparison_result->type_coerced = true;
|
||||
|
@ -44,7 +44,7 @@ class UnionTypeComparator
|
||||
bool $allow_interface_equality = false,
|
||||
bool $allow_float_int_equality = true
|
||||
): bool {
|
||||
if ($container_type->isMixed()) {
|
||||
if ($container_type->isVanillaMixed()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -63,9 +63,6 @@ class UnionTypeComparator
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($container_type->hasMixed() && !$container_type->isEmptyMixed()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$container_has_template = $container_type->hasTemplateOrStatic();
|
||||
|
||||
|
@ -173,5 +173,9 @@ class TypeComparatorTest extends TestCase
|
||||
'list<int>',
|
||||
'array{int, string}',
|
||||
];
|
||||
yield 'nonEmptyMixedDoesNotAcceptMixed' => [
|
||||
'non-empty-mixed',
|
||||
'mixed',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user