1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00
This commit is contained in:
Daniil Gentili 2022-10-03 12:09:42 +02:00
parent c2ce7e63da
commit 79b13fab04
3 changed files with 16 additions and 5 deletions

View File

@ -340,9 +340,11 @@ class AssertionReconciler extends Reconciler
}
if ($acceptable_atomic_types) {
$acceptable_atomic_types = count($acceptable_atomic_types) === count($existing_var_type->getAtomicTypes())
? $existing_var_type
: new Union($acceptable_atomic_types);
$acceptable_atomic_types =
count($acceptable_atomic_types) === count($existing_var_type->getAtomicTypes())
? $existing_var_type
: new Union($acceptable_atomic_types)
;
return new Union([$new_type_part->replaceAs($acceptable_atomic_types)]);
}
}

View File

@ -252,7 +252,13 @@ class TypeCombiner
if ($generic_type === 'iterable') {
$new_types[] = new TIterable($generic_type_params);
} else {
$generic_object = new TGenericObject($generic_type, $generic_type_params, false, false, $combination->extra_types);
$generic_object = new TGenericObject(
$generic_type,
$generic_type_params,
false,
false,
$combination->extra_types
);
$new_types[] = $generic_object;
if ($combination->named_object_types) {

View File

@ -243,7 +243,10 @@ class TypeExpander
$return_type = $return_type->replaceClassLike('self', $self_class);
}
if (is_string($static_class_type) || $self_class) {
$return_type = $return_type->replaceClassLike('static', is_string($static_class_type) ? $static_class_type : $self_class);
$return_type = $return_type->replaceClassLike(
'static',
is_string($static_class_type) ? $static_class_type : $self_class
);
}
if ($evaluate_class_constants && $codebase->classOrInterfaceOrEnumExists($return_type->fq_classlike_name)) {