mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Don’t alter behaviour
This commit is contained in:
parent
5f065d3d74
commit
1ce45516db
@ -888,19 +888,20 @@ class CallAnalyzer
|
|||||||
foreach ($template_result->lower_bounds as $template_name => $defining_map) {
|
foreach ($template_result->lower_bounds as $template_name => $defining_map) {
|
||||||
foreach ($defining_map as $defining_id => $lower_bound) {
|
foreach ($defining_map as $defining_id => $lower_bound) {
|
||||||
if (isset($template_result->upper_bounds[$template_name][$defining_id])) {
|
if (isset($template_result->upper_bounds[$template_name][$defining_id])) {
|
||||||
$upper_bound = $template_result->upper_bounds[$template_name][$defining_id];
|
$upper_bound_type = $template_result->upper_bounds[$template_name][$defining_id]->type;
|
||||||
|
$lower_bound_type = $lower_bound->type;
|
||||||
|
|
||||||
$union_comparison_result = new \Psalm\Internal\Type\Comparator\TypeComparisonResult();
|
$union_comparison_result = new \Psalm\Internal\Type\Comparator\TypeComparisonResult();
|
||||||
|
|
||||||
if (count($template_result->lower_bounds_unintersectable_types) > 1) {
|
if (count($template_result->lower_bounds_unintersectable_types) > 1) {
|
||||||
[$upper_bound->type, $lower_bound->type]
|
[$upper_bound_type, $lower_bound_type]
|
||||||
= $template_result->lower_bounds_unintersectable_types;
|
= $template_result->lower_bounds_unintersectable_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UnionTypeComparator::isContainedBy(
|
if (!UnionTypeComparator::isContainedBy(
|
||||||
$statements_analyzer->getCodebase(),
|
$statements_analyzer->getCodebase(),
|
||||||
$upper_bound->type,
|
$upper_bound_type,
|
||||||
$lower_bound->type,
|
$lower_bound_type,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
$union_comparison_result
|
$union_comparison_result
|
||||||
@ -909,8 +910,8 @@ class CallAnalyzer
|
|||||||
if ($union_comparison_result->type_coerced_from_mixed) {
|
if ($union_comparison_result->type_coerced_from_mixed) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new MixedArgumentTypeCoercion(
|
new MixedArgumentTypeCoercion(
|
||||||
'Type ' . $upper_bound->type->getId() . ' should be a subtype of '
|
'Type ' . $upper_bound_type->getId() . ' should be a subtype of '
|
||||||
. $lower_bound->type->getId(),
|
. $lower_bound_type->getId(),
|
||||||
$code_location,
|
$code_location,
|
||||||
$function_id
|
$function_id
|
||||||
),
|
),
|
||||||
@ -921,8 +922,8 @@ class CallAnalyzer
|
|||||||
} else {
|
} else {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new ArgumentTypeCoercion(
|
new ArgumentTypeCoercion(
|
||||||
'Type ' . $upper_bound->type->getId() . ' should be a subtype of '
|
'Type ' . $upper_bound_type->getId() . ' should be a subtype of '
|
||||||
. $lower_bound->type->getId(),
|
. $lower_bound_type->getId(),
|
||||||
$code_location,
|
$code_location,
|
||||||
$function_id
|
$function_id
|
||||||
),
|
),
|
||||||
@ -934,8 +935,8 @@ class CallAnalyzer
|
|||||||
} elseif ($union_comparison_result->scalar_type_match_found) {
|
} elseif ($union_comparison_result->scalar_type_match_found) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new InvalidScalarArgument(
|
new InvalidScalarArgument(
|
||||||
'Type ' . $upper_bound->type->getId() . ' should be a subtype of '
|
'Type ' . $upper_bound_type->getId() . ' should be a subtype of '
|
||||||
. $lower_bound->type->getId(),
|
. $lower_bound_type->getId(),
|
||||||
$code_location,
|
$code_location,
|
||||||
$function_id
|
$function_id
|
||||||
),
|
),
|
||||||
@ -946,8 +947,8 @@ class CallAnalyzer
|
|||||||
} else {
|
} else {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new InvalidArgument(
|
new InvalidArgument(
|
||||||
'Type ' . $upper_bound->type->getId() . ' should be a subtype of '
|
'Type ' . $upper_bound_type->getId() . ' should be a subtype of '
|
||||||
. $lower_bound->type->getId(),
|
. $lower_bound_type->getId(),
|
||||||
$code_location,
|
$code_location,
|
||||||
$function_id
|
$function_id
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user