mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Allow static to carry intersection types
This commit is contained in:
parent
1f3fab4cad
commit
786ac6c4eb
@ -673,7 +673,7 @@ class MethodCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
|||||||
$codebase,
|
$codebase,
|
||||||
$return_type_candidate,
|
$return_type_candidate,
|
||||||
$self_fq_class_name,
|
$self_fq_class_name,
|
||||||
$fq_class_name
|
$fq_class_name . ($intersection_types ? '&' . implode('&', $intersection_types) : '')
|
||||||
);
|
);
|
||||||
|
|
||||||
$return_type_location = $codebase->methods->getMethodReturnTypeLocation(
|
$return_type_location = $codebase->methods->getMethodReturnTypeLocation(
|
||||||
|
@ -889,7 +889,18 @@ class ExpressionAnalyzer
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return_type->value = $static_class;
|
if (strpos($static_class, '&')) {
|
||||||
|
$static_classes = explode('&', $static_class);
|
||||||
|
$return_type->value = array_shift($static_classes);
|
||||||
|
$return_type->extra_types = array_map(
|
||||||
|
function (string $extra_type) : Type\Atomic\TNamedObject {
|
||||||
|
return new Type\Atomic\TNamedObject($extra_type);
|
||||||
|
},
|
||||||
|
$static_classes
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$return_type->value = $static_class;
|
||||||
|
}
|
||||||
} elseif ($return_type_lc === 'self') {
|
} elseif ($return_type_lc === 'self') {
|
||||||
if (!$self_class) {
|
if (!$self_class) {
|
||||||
throw new \UnexpectedValueException(
|
throw new \UnexpectedValueException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user