1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 01:09:38 +01:00

unset instead of reassign

This commit is contained in:
orklah 2021-09-25 18:11:54 +02:00
parent 06da96843a
commit 41ea541084
4 changed files with 16 additions and 21 deletions

View File

@ -106,8 +106,8 @@ abstract class ClassLikeAnalyzer extends SourceAnalyzer
public function __destruct()
{
$this->source = null;
$this->file_analyzer = null;
unset($this->source);
unset($this->file_analyzer);
}
public function getMethodMutations(

View File

@ -662,7 +662,6 @@ class FileAnalyzer extends SourceAnalyzer
public function clearSourceBeforeDestruction() : void
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->source = null;
unset($this->source);
}
}

View File

@ -18,7 +18,7 @@ abstract class SourceAnalyzer implements StatementsSource
public function __destruct()
{
$this->source = null;
unset($this->source);
}
public function getAliases(): Aliases

View File

@ -98,10 +98,9 @@ class SwitchCaseAnalyzer
$case_context->inside_conditional = true;
if (ExpressionAnalyzer::analyze($statements_analyzer, $case->cond, $case_context) === false) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$case_scope->parent_context = null;
$case_context->case_scope = null;
$case_context->parent_context = null;
unset($case_scope->parent_context);
unset($case_context->case_scope);
unset($case_context->parent_context);
return false;
}
@ -273,10 +272,9 @@ class SwitchCaseAnalyzer
$switch_scope->leftover_statements = [$case_if_stmt];
}
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$case_scope->parent_context = null;
$case_context->case_scope = null;
$case_context->parent_context = null;
unset($case_scope->parent_context);
unset($case_context->case_scope);
unset($case_context->parent_context);
$statements_analyzer->node_data = $old_node_data;
@ -500,10 +498,9 @@ class SwitchCaseAnalyzer
$case_exit_type,
$switch_scope
) === false) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$case_scope->parent_context = null;
$case_context->case_scope = null;
$case_context->parent_context = null;
unset($case_scope->parent_context);
unset($case_context->case_scope);
unset($case_context->parent_context);
return false;
}
@ -558,10 +555,9 @@ class SwitchCaseAnalyzer
}
}
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$case_scope->parent_context = null;
$case_context->case_scope = null;
$case_context->parent_context = null;
unset($case_scope->parent_context);
unset($case_context->case_scope);
unset($case_context->parent_context);
return null;
}