diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php index 39ff4d5eacf..9679e28118e 100644 --- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php @@ -746,9 +746,6 @@ public function analyze( ) : $property_type; - /** - * @psalm-suppress ReferenceConstraintViolation - */ $class_template_params = MethodCallAnalyzer::getClassTemplateParams( $codebase, $property_class_storage, diff --git a/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php index a0b8eca65e6..eba2bf7c335 100644 --- a/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php @@ -113,9 +113,7 @@ public function __construct(PhpParser\Node\Stmt\ClassLike $class, SourceAnalyzer public function __destruct() { - /** @psalm-suppress PossiblyNullPropertyAssignmentValue */ $this->source = null; - /** @psalm-suppress PossiblyNullPropertyAssignmentValue */ $this->file_analyzer = null; } diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index ace982734e8..01b6fe3804b 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -523,6 +523,11 @@ function (FunctionLikeParameter $p) { 'PossiblyUndefinedMethod', ]); } + } elseif ($cased_method_id && strpos($cased_method_id, '__destruct')) { + $statements_analyzer->addSuppressedIssues([ + 'InvalidPropertyAssignmentValue', + 'PossiblyNullPropertyAssignmentValue', + ]); } $statements_analyzer->analyze($function_stmts, $context, $global_context, true); @@ -610,7 +615,6 @@ function (FunctionLikeParameter $p) { ) { if ($function_type = $statements_analyzer->node_data->getType($this->function)) { /** - * @psalm-suppress PossiblyUndefinedStringArrayOffset * @var Type\Atomic\TFn */ $closure_atomic = \array_values($function_type->getAtomicTypes())[0]; diff --git a/src/Psalm/Internal/Analyzer/SourceAnalyzer.php b/src/Psalm/Internal/Analyzer/SourceAnalyzer.php index 5a10cbc67ed..e23fca0fab7 100644 --- a/src/Psalm/Internal/Analyzer/SourceAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/SourceAnalyzer.php @@ -18,7 +18,6 @@ abstract class SourceAnalyzer implements StatementsSource public function __destruct() { - /** @psalm-suppress PossiblyNullPropertyAssignmentValue */ $this->source = null; } diff --git a/src/Psalm/Internal/Scope/LoopScope.php b/src/Psalm/Internal/Scope/LoopScope.php index 41ad4fb9d64..1136cb64d6a 100644 --- a/src/Psalm/Internal/Scope/LoopScope.php +++ b/src/Psalm/Internal/Scope/LoopScope.php @@ -83,9 +83,7 @@ public function __construct(Context $loop_context, Context $parent_context) public function __destruct() { - /** @psalm-suppress PossiblyNullPropertyAssignmentValue */ $this->loop_context = null; - /** @psalm-suppress PossiblyNullPropertyAssignmentValue */ $this->loop_parent_context = null; } } diff --git a/src/Psalm/Internal/Type/AssertionReconciler.php b/src/Psalm/Internal/Type/AssertionReconciler.php index 47f6651a60e..dccc5f4d3f5 100644 --- a/src/Psalm/Internal/Type/AssertionReconciler.php +++ b/src/Psalm/Internal/Type/AssertionReconciler.php @@ -864,7 +864,6 @@ private static function reconcileNonEmptyCountable( $old_var_type_string = $existing_var_type->getId(); if ($existing_var_type->hasType('array')) { - /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ $array_atomic_type = $existing_var_type->getAtomicTypes()['array']; $did_remove_type = false; @@ -2525,7 +2524,6 @@ private static function filterTypeWithAnother( if ($has_param_match && $existing_type_part->type_params[$i]->getId() !== $new_param->getId() ) { - /** @psalm-suppress PropertyTypeCoercion */ $existing_type_part->type_params[$i] = $new_param; if (!$has_local_match) { diff --git a/tests/FileDiffTest.php b/tests/FileDiffTest.php index 4b4f1451e06..1f2dea3ffce 100644 --- a/tests/FileDiffTest.php +++ b/tests/FileDiffTest.php @@ -194,7 +194,6 @@ private function assertTreesEqual(array $a, array $b) $this->assertTrue(isset($b_stmt->stmts)); /** - * @psalm-suppress UndefinedPropertyFetch * @psalm-suppress MixedArgument */ $this->assertTreesEqual($a_stmt->stmts, $b_stmt->stmts); diff --git a/tests/TestCase.php b/tests/TestCase.php index cae8d44db12..f1fa9a847bc 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -136,7 +136,6 @@ protected function getTestName($withDataSet = true) { $name = parent::getName($withDataSet); /** - * @psalm-suppress DocblockTypeContradiction PHPUnit 7 introduced nullable name * @psalm-suppress TypeDoesNotContainNull PHPUnit 8.2 made it non-nullable again */ if (null === $name) {