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

Fix issues found by Psalm

This commit is contained in:
Matthew Brown 2019-06-29 21:13:02 -04:00
parent 6b7788b502
commit 9ab3161675
3 changed files with 8 additions and 2 deletions

View File

@ -624,8 +624,9 @@ class FileAnalyzer extends SourceAnalyzer implements StatementsSource
return $this->first_statement_offset;
}
public function clearSourceBeforeDestruction()
public function clearSourceBeforeDestruction() : void
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->source = null;
}
}

View File

@ -17,7 +17,8 @@ abstract class SourceAnalyzer implements StatementsSource
*/
protected $source;
public function __destruct() {
public function __destruct()
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->source = null;
}

View File

@ -256,6 +256,7 @@ class SwitchAnalyzer
if ($case->cond) {
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;
@ -367,6 +368,7 @@ class SwitchAnalyzer
$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;
@ -530,6 +532,7 @@ class SwitchAnalyzer
$switch_scope,
$case_scope
) === false) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$case_scope->parent_context = null;
$case_context->case_scope = null;
$case_context->parent_context = null;
@ -591,6 +594,7 @@ class SwitchAnalyzer
}
}
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$case_scope->parent_context = null;
$case_context->case_scope = null;
$case_context->parent_context = null;