mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix a few edgecases
This commit is contained in:
parent
8fd671bdc4
commit
368b6670d7
@ -441,7 +441,9 @@ class CommentChecker
|
||||
$special[$type] = [];
|
||||
}
|
||||
|
||||
$special[$type][$line_map && isset($line_map[$_]) ? $line_map[$_] : $m] = $data;
|
||||
$line_number = $line_map && isset($line_map[$_]) ? $line_map[$_] : (int)$m;
|
||||
|
||||
$special[$type][$line_number] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1075,10 @@ class FetchChecker
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
$stmt->inferredType = Type::getMixed();
|
||||
|
||||
if (!IssueBuffer::isRecording()) {
|
||||
$stmt->inferredType = Type::getMixed();
|
||||
}
|
||||
}
|
||||
} elseif ($type instanceof Type\Atomic\ObjectLike) {
|
||||
$object_like_keys = array_keys($type->properties);
|
||||
|
@ -218,11 +218,18 @@ class Context
|
||||
$redefined_vars = [];
|
||||
|
||||
foreach ($original_context->vars_in_scope as $var => $context_type) {
|
||||
if (isset($this->vars_in_scope[$var]) &&
|
||||
!$this->vars_in_scope[$var]->failed_reconciliation &&
|
||||
(string)$this->vars_in_scope[$var] !== (string)$context_type
|
||||
if (!isset($this->vars_in_scope[$var])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this_var = $this->vars_in_scope[$var];
|
||||
|
||||
if (!$this_var->failed_reconciliation &&
|
||||
!$this_var->isEmpty() &&
|
||||
!$context_type->isEmpty() &&
|
||||
(string)$this_var !== (string)$context_type
|
||||
) {
|
||||
$redefined_vars[$var] = $this->vars_in_scope[$var];
|
||||
$redefined_vars[$var] = $this_var;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,6 +279,14 @@ class IssueBuffer
|
||||
self::$recorded_issues = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isRecording()
|
||||
{
|
||||
return self::$recording_level > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user