1
0
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:
Matthew Brown 2017-12-02 13:32:20 -05:00
parent c112ca9a63
commit cfeb4c2586
5 changed files with 9 additions and 11 deletions

View File

@ -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 = [];

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -14,7 +14,7 @@ class Context
public $vars_in_scope = [];
/**
* @var array<string, bool|string>
* @var array<string, bool>
*/
public $vars_possibly_in_scope = [];

View File

@ -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 = [];