1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 10:38:49 +01:00

bugfix: allow non-single union types in assertions

fixes #5657

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
Maximilian Bösing 2022-06-09 00:26:34 +02:00
parent a9daa3ba02
commit 40971ff57d
No known key found for this signature in database
GPG Key ID: 9A8988C93CEC81A3

View File

@ -763,13 +763,14 @@ class CallAnalyzer
$codebase
);
if ($union->isSingle()) {
if (!$union->hasMixed()) {
foreach ($union->getAtomicTypes() as $atomic_type) {
if ($assertion_type instanceof TTemplateParam
&& $assertion_type->as->getId() === $atomic_type->getId()
) {
continue;
}
$assertion_rule = clone $assertion_rule;
$assertion_rule->setAtomicType($atomic_type);
$orred_rules[] = $assertion_rule;