mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix union of literal class string
This commit is contained in:
parent
9aeaf1a4ed
commit
b091ceaa9a
@ -370,7 +370,7 @@ class Union
|
||||
}
|
||||
|
||||
$printed_float = true;
|
||||
} elseif ($type instanceof TLiteralString) {
|
||||
} elseif ($type instanceof TLiteralString && !$type instanceof Type\Atomic\TLiteralClassString) {
|
||||
if ($printed_string) {
|
||||
continue;
|
||||
}
|
||||
@ -1690,12 +1690,9 @@ class Union
|
||||
foreach ($this->types as $key => $atomic_type) {
|
||||
$atomic_type->replaceClassLike($old, $new);
|
||||
|
||||
unset($this->types[$key]);
|
||||
|
||||
$this->types[$atomic_type->getKey()] = $atomic_type;
|
||||
$this->removeType($key);
|
||||
$this->addType($atomic_type);
|
||||
}
|
||||
|
||||
$this->id = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,9 +94,10 @@ class ClassMoveTest extends \Psalm\Tests\TestCase
|
||||
|
||||
/**
|
||||
* @param A $a
|
||||
* @param A::class|C::class $b
|
||||
* @return A
|
||||
*/
|
||||
function foo(A $a) : A {
|
||||
function foo(A $a, string $b) : A {
|
||||
return $a;
|
||||
}
|
||||
|
||||
@ -118,9 +119,10 @@ class ClassMoveTest extends \Psalm\Tests\TestCase
|
||||
|
||||
/**
|
||||
* @param B $a
|
||||
* @param B::class|C::class $b
|
||||
* @return B
|
||||
*/
|
||||
function foo(B $a) : B {
|
||||
function foo(B $a, string $b) : B {
|
||||
return $a;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user