mirror of
https://github.com/danog/psalm.git
synced 2024-12-04 10:38:49 +01:00
makes Psalm understand templates in lhs
This commit is contained in:
parent
213644d48e
commit
12ecaaa84d
@ -450,6 +450,16 @@ class CallableTypeComparator
|
||||
foreach ($lhs->getAtomicTypes() as $lhs_atomic_type) {
|
||||
if ($lhs_atomic_type instanceof TNamedObject) {
|
||||
$class_name = $lhs_atomic_type->value;
|
||||
} elseif ($lhs_atomic_type instanceof Atomic\TTemplateParam) {
|
||||
$lhs_template_type = $lhs_atomic_type->as;
|
||||
if ($lhs_template_type->isSingle()) {
|
||||
$lhs_template_atomic_type = $lhs_template_type->getSingleAtomic();
|
||||
if ($lhs_template_atomic_type instanceof TNamedObject) {
|
||||
$class_name = $lhs_template_atomic_type->value;
|
||||
} elseif ($lhs_template_atomic_type instanceof Type\Atomic\TClassString) {
|
||||
$class_name = $lhs_template_atomic_type->as;
|
||||
}
|
||||
}
|
||||
} elseif ($lhs_atomic_type instanceof Type\Atomic\TClassString
|
||||
&& $lhs_atomic_type->as
|
||||
) {
|
||||
|
@ -1680,4 +1680,9 @@ class Union implements TypeNode
|
||||
{
|
||||
return count($this->literal_float_types) > 0;
|
||||
}
|
||||
|
||||
public function getSingleAtomic(): Atomic
|
||||
{
|
||||
return reset($this->types);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user