mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Improve handling of T::class when mixed is passed
This commit is contained in:
parent
8b5e8402a1
commit
a8851ff425
@ -90,7 +90,8 @@ class ConstFetchAnalyzer
|
||||
) {
|
||||
$codebase = $statements_analyzer->getCodebase();
|
||||
|
||||
if ($context->check_consts
|
||||
if (($context->check_consts
|
||||
|| ($stmt->name instanceof PhpParser\Node\Identifier && $stmt->name->name === 'class'))
|
||||
&& $stmt->class instanceof PhpParser\Node\Name
|
||||
) {
|
||||
$first_part_lc = strtolower($stmt->class->parts[0]);
|
||||
|
@ -778,6 +778,8 @@ class Union
|
||||
if ($valid_input_atomic_types) {
|
||||
$generic_params[$atomic_type->param_name] = new Union($valid_input_atomic_types);
|
||||
$generic_params[$atomic_type->param_name]->setFromDocblock();
|
||||
} else {
|
||||
$generic_params[$atomic_type->param_name] = Type::getMixed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -848,7 +850,9 @@ class Union
|
||||
$is_mixed = false;
|
||||
|
||||
foreach ($this->types as $key => $atomic_type) {
|
||||
if (isset($template_types[$key])) {
|
||||
if ($atomic_type instanceof Type\Atomic\TGenericParam
|
||||
&& isset($template_types[$key])
|
||||
) {
|
||||
$keys_to_unset[] = $key;
|
||||
$template_type = clone $template_types[$key];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user