mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix bugs
This commit is contained in:
parent
27a0651b6c
commit
a7245b4459
@ -504,7 +504,12 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
|
|||||||
$name_code_location,
|
$name_code_location,
|
||||||
$statements_analyzer->getSuppressedIssues()
|
$statements_analyzer->getSuppressedIssues()
|
||||||
) === false) {
|
) === false) {
|
||||||
self::updateResultReturnType($result, $return_type_candidate, $all_intersection_return_type);
|
self::updateResultReturnType(
|
||||||
|
$result,
|
||||||
|
$return_type_candidate,
|
||||||
|
$all_intersection_return_type,
|
||||||
|
$method_name_lc
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -703,14 +708,20 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self::updateResultReturnType($result, $return_type_candidate, $all_intersection_return_type);
|
self::updateResultReturnType(
|
||||||
|
$result,
|
||||||
|
$return_type_candidate,
|
||||||
|
$all_intersection_return_type,
|
||||||
|
$method_name_lc
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function updateResultReturnType(
|
private static function updateResultReturnType(
|
||||||
AtomicMethodCallAnalysisResult $result,
|
AtomicMethodCallAnalysisResult $result,
|
||||||
?Type\Union $return_type_candidate,
|
?Type\Union $return_type_candidate,
|
||||||
?Type\Union $all_intersection_return_type
|
?Type\Union $all_intersection_return_type,
|
||||||
) {
|
string $method_name
|
||||||
|
) : void {
|
||||||
if ($return_type_candidate) {
|
if ($return_type_candidate) {
|
||||||
if ($all_intersection_return_type) {
|
if ($all_intersection_return_type) {
|
||||||
$return_type_candidate = Type::intersectUnionTypes(
|
$return_type_candidate = Type::intersectUnionTypes(
|
||||||
@ -730,7 +741,7 @@ class AtomicMethodCallAnalyzer extends CallAnalyzer
|
|||||||
} else {
|
} else {
|
||||||
$result->return_type = Type::combineUnionTypes($all_intersection_return_type, $result->return_type);
|
$result->return_type = Type::combineUnionTypes($all_intersection_return_type, $result->return_type);
|
||||||
}
|
}
|
||||||
} elseif (strtolower($stmt->name->name) === '__tostring') {
|
} elseif ($method_name === '__tostring') {
|
||||||
$result->return_type = Type::getString();
|
$result->return_type = Type::getString();
|
||||||
} else {
|
} else {
|
||||||
$result->return_type = Type::getMixed();
|
$result->return_type = Type::getMixed();
|
||||||
|
@ -79,8 +79,6 @@ class MethodCallReturnTypeFetcher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$return_type_candidate = null;
|
|
||||||
|
|
||||||
$class_storage = $codebase->methods->getClassLikeStorageForMethod($method_id);
|
$class_storage = $codebase->methods->getClassLikeStorageForMethod($method_id);
|
||||||
|
|
||||||
if (CallMap::inCallMap((string) $call_map_id)) {
|
if (CallMap::inCallMap((string) $call_map_id)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user