1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00

bugfix: single does not mean that only one single atomic type is stored within a union

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
Maximilian Bösing 2022-06-12 19:39:13 +02:00
parent 3fd7a8b6d7
commit 0d96766640
No known key found for this signature in database
GPG Key ID: 9A8988C93CEC81A3

View File

@ -764,10 +764,13 @@ class CallAnalyzer
);
if ($union->isSingle()) {
$atomic_type = $union->getSingleAtomic();
if (!$assertion_type instanceof TTemplateParam
|| $assertion_type->as->getId() !== $atomic_type->getId()
) {
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;