mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Check for the existence of the 'mixed' key to detect untyped parameters
This commit is contained in:
parent
0a40286830
commit
9083e0a7a3
@ -52,6 +52,8 @@ use function reset;
|
|||||||
use function sort;
|
use function sort;
|
||||||
use function strpos;
|
use function strpos;
|
||||||
|
|
||||||
|
use const ARRAY_FILTER_USE_BOTH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @psalm-immutable
|
* @psalm-immutable
|
||||||
* @psalm-import-type TProperties from Union
|
* @psalm-import-type TProperties from Union
|
||||||
@ -800,11 +802,13 @@ trait UnionTrait
|
|||||||
return count(
|
return count(
|
||||||
array_filter(
|
array_filter(
|
||||||
$this->types,
|
$this->types,
|
||||||
static fn($type): bool => $type instanceof TMixed
|
static fn($type, $key): bool => $key === 'mixed'
|
||||||
|
|| $type instanceof TMixed
|
||||||
|| ($check_templates
|
|| ($check_templates
|
||||||
&& $type instanceof TTemplateParam
|
&& $type instanceof TTemplateParam
|
||||||
&& $type->as->isMixed()
|
&& $type->as->isMixed()
|
||||||
)
|
),
|
||||||
|
ARRAY_FILTER_USE_BOTH,
|
||||||
),
|
),
|
||||||
) === count($this->types);
|
) === count($this->types);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user