mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix by ref method location
This commit is contained in:
parent
5b45909d6f
commit
95553ffc0e
@ -126,19 +126,7 @@ class MethodChecker extends FunctionLikeChecker
|
||||
|
||||
$storage = self::getStorage($project_checker, $method_id);
|
||||
|
||||
if ($storage->return_type) {
|
||||
return $storage->returns_by_ref;
|
||||
}
|
||||
|
||||
$class_storage = $project_checker->classlike_storage_provider->get($fq_class_name);
|
||||
|
||||
foreach ($class_storage->overridden_method_ids[$method_name] as $overridden_method_id) {
|
||||
$overridden_storage = self::getStorage($project_checker, $overridden_method_id);
|
||||
|
||||
return $overridden_storage->returns_by_ref;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $storage->returns_by_ref;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1127,7 +1127,11 @@ class CallChecker
|
||||
|
||||
$stmt->inferredType = $return_type;
|
||||
|
||||
if ($returns_by_ref && $stmt->inferredType && !$stmt->inferredType->by_ref) {
|
||||
if ($returns_by_ref) {
|
||||
if (!$stmt->inferredType) {
|
||||
$stmt->inferredType = Type::getMixed();
|
||||
}
|
||||
|
||||
$stmt->inferredType->by_ref = $returns_by_ref;
|
||||
}
|
||||
}
|
||||
|
@ -743,7 +743,6 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
);
|
||||
|
||||
if ($stmt->returnsByRef()) {
|
||||
$storage->returns_by_ref = true;
|
||||
$storage->return_type->by_ref = true;
|
||||
}
|
||||
|
||||
@ -751,6 +750,10 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
$storage->signature_return_type_location = $storage->return_type_location;
|
||||
}
|
||||
|
||||
if ($stmt->returnsByRef()) {
|
||||
$storage->returns_by_ref = true;
|
||||
}
|
||||
|
||||
$doc_comment = $stmt->getDocComment();
|
||||
|
||||
if (!$doc_comment) {
|
||||
@ -907,8 +910,7 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
$storage->return_type->ignore_nullable_issues = true;
|
||||
}
|
||||
|
||||
if ($storage->return_type && $stmt->returnsByRef()) {
|
||||
$storage->returns_by_ref = true;
|
||||
if ($stmt->returnsByRef() && $storage->return_type) {
|
||||
$storage->return_type->by_ref = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user