1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Flesh out callmap type

This commit is contained in:
Matt Brown 2018-01-05 11:50:27 -05:00
parent 2ebf6a0ef5
commit 45eaea1ed9
2 changed files with 11 additions and 1 deletions

View File

@ -986,6 +986,13 @@ class CallChecker
$return_type_candidate = Type::getString(); $return_type_candidate = Type::getString();
} elseif (FunctionChecker::inCallMap($cased_method_id)) { } elseif (FunctionChecker::inCallMap($cased_method_id)) {
$return_type_candidate = FunctionChecker::getReturnTypeFromCallMap($method_id); $return_type_candidate = FunctionChecker::getReturnTypeFromCallMap($method_id);
$return_type_candidate = ExpressionChecker::fleshOutType(
$project_checker,
$return_type_candidate,
$fq_class_name,
$method_id
);
} else { } else {
if (MethodChecker::checkMethodVisibility( if (MethodChecker::checkMethodVisibility(
$method_id, $method_id,

View File

@ -74,9 +74,12 @@ class MethodCallTest extends TestCase
final class MyDate extends DateTimeImmutable {} final class MyDate extends DateTimeImmutable {}
$today = new MyDate(); $today = new MyDate();
$yesterday = $today->sub(new DateInterval("P1D"));', $yesterday = $today->sub(new DateInterval("P1D"));
$b = (new DateTimeImmutable())->modify("+3 hours");',
'assertions' => [ 'assertions' => [
'$yesterday' => 'MyDate', '$yesterday' => 'MyDate',
'$b' => 'DateTimeImmutable',
], ],
], ],
]; ];