Skip to content

Commit

Permalink
Remove some unnecessary errors
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Feb 7, 2020
1 parent e567f8c commit da541db
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/Psalm/Internal/Analyzer/ClassAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,6 @@ public function analyze(
)
: $property_type;

/**
* @psalm-suppress ReferenceConstraintViolation
*/
$class_template_params = MethodCallAnalyzer::getClassTemplateParams(
$codebase,
$property_class_storage,
Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 5 additions & 1 deletion src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Analyzer/SourceAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ abstract class SourceAnalyzer implements StatementsSource

public function __destruct()
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->source = null;
}

Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Scope/LoopScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Type/AssertionReconciler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion tests/FileDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit da541db

Please sign in to comment.