1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Remove unnecessary switch statement code

This commit is contained in:
Matthew Brown 2022-03-11 22:02:55 -05:00
parent a0739b1716
commit 427eecdcd8

View File

@ -464,12 +464,6 @@ class SwitchCaseAnalyzer
);
}
$pre_possibly_assigned_var_ids = $case_context->possibly_assigned_var_ids;
$case_context->possibly_assigned_var_ids = [];
$pre_assigned_var_ids = $case_context->assigned_var_ids;
$case_context->assigned_var_ids = [];
$statements_analyzer->analyze($case_stmts, $case_context);
$traverser = new PhpParser\NodeTraverser;
@ -484,15 +478,6 @@ class SwitchCaseAnalyzer
$statements_analyzer->node_data = $old_node_data;
/** @var array<string, int> */
$new_case_assigned_var_ids = $case_context->assigned_var_ids;
$case_context->assigned_var_ids = $pre_assigned_var_ids + $new_case_assigned_var_ids;
/** @var array<string, bool> */
$new_case_possibly_assigned_var_ids = $case_context->possibly_assigned_var_ids;
$case_context->possibly_assigned_var_ids =
$pre_possibly_assigned_var_ids + $new_case_possibly_assigned_var_ids;
$context->referenced_var_ids = array_merge(
$context->referenced_var_ids,
$case_context->referenced_var_ids