mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Remove unused variables
This commit is contained in:
parent
307cdbbbb3
commit
a3a208a7c9
@ -199,8 +199,6 @@ class TryAnalyzer
|
||||
$fq_catch_classes[] = $fq_catch_class;
|
||||
}
|
||||
|
||||
$potentially_caught_classes = array_flip($fq_catch_classes);
|
||||
|
||||
if ($catch_context->collect_exceptions) {
|
||||
foreach ($fq_catch_classes as $fq_catch_class) {
|
||||
$fq_catch_class_lower = strtolower($fq_catch_class);
|
||||
@ -333,13 +331,6 @@ class TryAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if ($context->collect_exceptions) {
|
||||
$potentially_caught_classes = array_diff_key(
|
||||
$potentially_caught_classes,
|
||||
$context->possibly_thrown_exceptions
|
||||
);
|
||||
}
|
||||
|
||||
if ($catch_actions[$i] !== [ScopeAnalyzer::ACTION_END]) {
|
||||
foreach ($catch_context->vars_in_scope as $var_id => $type) {
|
||||
if (isset($context->vars_in_scope[$var_id])
|
||||
|
@ -347,15 +347,13 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource
|
||||
$case_scope->break_vars = [];
|
||||
}
|
||||
|
||||
foreach ($context->vars_in_scope as $var_id => $type) {
|
||||
if (isset($case_scope->break_vars[$var_id])) {
|
||||
$case_scope->break_vars[$var_id] = Type::combineUnionTypes(
|
||||
$type,
|
||||
$case_scope->break_vars[$var_id]
|
||||
);
|
||||
} else {
|
||||
$case_scope->break_vars[$var_id] = $type;
|
||||
}
|
||||
if (isset($case_scope->break_vars[$var_id])) {
|
||||
$case_scope->break_vars[$var_id] = Type::combineUnionTypes(
|
||||
$type,
|
||||
$case_scope->break_vars[$var_id]
|
||||
);
|
||||
} else {
|
||||
$case_scope->break_vars[$var_id] = $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -731,12 +729,10 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource
|
||||
|
||||
if ($ignore_variable_property) {
|
||||
$context->ignore_variable_property = false;
|
||||
$ignore_variable_property = false;
|
||||
}
|
||||
|
||||
if ($ignore_variable_method) {
|
||||
$context->ignore_variable_method = false;
|
||||
$ignore_variable_method = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ class Methods
|
||||
|| $atomic_type instanceof Type\Atomic\TIterable
|
||||
|| $atomic_type instanceof Type\Atomic\TGenericObject
|
||||
) {
|
||||
foreach ($atomic_type->type_params as $type_param) {
|
||||
foreach ($atomic_type->type_params as &$type_param) {
|
||||
$type_param = self::localizeParamType(
|
||||
$codebase,
|
||||
$type_param,
|
||||
|
@ -211,7 +211,6 @@ class FileDiffer
|
||||
$new_text_length--;
|
||||
}
|
||||
|
||||
$old_diff_text = substr($old_diff_text, $j);
|
||||
$new_diff_text = substr($new_diff_text, $j);
|
||||
|
||||
if ($last_change === null || $j) {
|
||||
|
@ -158,8 +158,6 @@ class ParseTree
|
||||
throw new TypeParseTreeException('Cannot parse comma without a parent node');
|
||||
}
|
||||
|
||||
$current_parent = $current_leaf->parent;
|
||||
|
||||
$context_node = $current_leaf;
|
||||
|
||||
if ($context_node instanceof ParseTree\GenericTree
|
||||
|
Loading…
Reference in New Issue
Block a user