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

Remove some unnecessary errors

This commit is contained in:
Matthew Brown 2020-02-06 23:10:18 -05:00
parent e567f8c728
commit da541dbb51
8 changed files with 5 additions and 13 deletions

View File

@ -746,9 +746,6 @@ class ClassAnalyzer extends ClassLikeAnalyzer
)
: $property_type;
/**
* @psalm-suppress ReferenceConstraintViolation
*/
$class_template_params = MethodCallAnalyzer::getClassTemplateParams(
$codebase,
$property_class_storage,

View File

@ -113,9 +113,7 @@ abstract class ClassLikeAnalyzer extends SourceAnalyzer implements StatementsSou
public function __destruct()
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->source = null;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->file_analyzer = null;
}

View File

@ -523,6 +523,11 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
'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 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
) {
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];

View File

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

View File

@ -83,9 +83,7 @@ class LoopScope
public function __destruct()
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->loop_context = null;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->loop_parent_context = null;
}
}

View File

@ -864,7 +864,6 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
$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 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
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) {

View File

@ -194,7 +194,6 @@ class FileDiffTest extends TestCase
$this->assertTrue(isset($b_stmt->stmts));
/**
* @psalm-suppress UndefinedPropertyFetch
* @psalm-suppress MixedArgument
*/
$this->assertTreesEqual($a_stmt->stmts, $b_stmt->stmts);

View File

@ -136,7 +136,6 @@ class TestCase extends BaseTestCase
{
$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) {