mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Simplify vars_possibly_in_scope types
This commit is contained in:
parent
c112ca9a63
commit
cfeb4c2586
@ -76,7 +76,7 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
|
||||
protected $return_vars_in_scope = [];
|
||||
|
||||
/**
|
||||
* @var array<string, array<string, bool|string>>
|
||||
* @var array<string, array<string, bool>>
|
||||
*/
|
||||
protected $return_vars_possibly_in_scope = [];
|
||||
|
||||
|
@ -192,10 +192,9 @@ class IfChecker
|
||||
);
|
||||
|
||||
$if_context->vars_in_scope = $if_vars_in_scope_reconciled;
|
||||
$if_context->vars_possibly_in_scope = array_merge(
|
||||
$reconcilable_if_types,
|
||||
$if_context->vars_possibly_in_scope
|
||||
);
|
||||
foreach ($reconcilable_if_types as $var_id => $type) {
|
||||
$if_context->vars_possibly_in_scope[$var_id] = true;
|
||||
}
|
||||
|
||||
if ($changed_var_ids) {
|
||||
$if_context->removeReconciledClauses($changed_var_ids);
|
||||
|
@ -120,10 +120,9 @@ class SwitchChecker
|
||||
}
|
||||
|
||||
$case_context->vars_in_scope = $case_vars_in_scope_reconciled;
|
||||
$case_context->vars_possibly_in_scope = array_merge(
|
||||
$reconcilable_if_types,
|
||||
$case_context->vars_possibly_in_scope
|
||||
);
|
||||
foreach ($reconcilable_if_types as $var_id => $type) {
|
||||
$case_context->vars_possibly_in_scope[$var_id] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ class Context
|
||||
public $vars_in_scope = [];
|
||||
|
||||
/**
|
||||
* @var array<string, bool|string>
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
public $vars_possibly_in_scope = [];
|
||||
|
||||
|
@ -9,7 +9,7 @@ class IfScope
|
||||
public $new_vars = null;
|
||||
|
||||
/**
|
||||
* @var array<string, boolean|string>
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
public $new_vars_possibly_in_scope = [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user