Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unused psalm-suppress (#4646)
  • Loading branch information
orklah committed Nov 21, 2020
1 parent 509a937 commit ae04865
Show file tree
Hide file tree
Showing 15 changed files with 0 additions and 24 deletions.
1 change: 0 additions & 1 deletion src/Psalm/Config/Creator.php
Expand Up @@ -181,7 +181,6 @@ public static function getPaths(string $current_dir, ?string $suggested_dir): ar
);
}

/** @psalm-suppress MixedAssignment */
if (!$composer_json = json_decode(file_get_contents($composer_json_location), true)) {
throw new ConfigCreationException('Invalid composer.json at ' . $composer_json_location);
}
Expand Down
Expand Up @@ -281,7 +281,6 @@ public static function analyze(
// discard all clauses because crazy stuff may have happened in try block
$catch_context->clauses = [];

/** @psalm-suppress RedundantConditionGivenDocblockType */
if ($catch->var && is_string($catch->var->name)) {
$catch_var_id = '$' . $catch->var->name;

Expand Down
Expand Up @@ -1205,7 +1205,6 @@ private static function coerceValueAfterGatekeeperArgument(
$context->vars_in_scope[$var_id] = new Type\Union([$unpacked_atomic_array]);
} elseif ($unpacked_atomic_array instanceof Type\Atomic\TArray) {
$unpacked_atomic_array = clone $unpacked_atomic_array;
/** @psalm-suppress PropertyTypeCoercion */
$unpacked_atomic_array->type_params[1] = $input_type;

$context->vars_in_scope[$var_id] = new Type\Union([$unpacked_atomic_array]);
Expand Down
Expand Up @@ -653,7 +653,6 @@ public static function getArrayAccessTypeGivenOffset(
&& $offset_as->param_name === $original_type->param_name
&& $offset_as->defining_class === $original_type->defining_class
) {
/** @psalm-suppress PropertyTypeCoercion */
$type->type_params[1] = new Type\Union([
new Type\Atomic\TTemplateIndexedAccess(
$offset_as->param_name,
Expand Down Expand Up @@ -740,7 +739,6 @@ public static function getArrayAccessTypeGivenOffset(
}

if ($in_assignment && $replacement_type) {
/** @psalm-suppress PropertyTypeCoercion */
$type->type_params[1] = Type::combineUnionTypes(
$type->type_params[1],
$replacement_type,
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php
Expand Up @@ -572,7 +572,6 @@ private static function potentiallyInferTypesOnClosureFromParentReturnType(
->getCodebase()
->getFunctionLikeStorage($statements_analyzer, $closure_id);

/** @psalm-suppress ArgumentTypeCoercion */
$parent_fn_storage = $statements_analyzer
->getCodebase()
->getFunctionLikeStorage(
Expand Down
3 changes: 0 additions & 3 deletions src/Psalm/Internal/Codebase/Populator.php
Expand Up @@ -185,7 +185,6 @@ private function populateClassLikeStorage(ClassLikeStorage $storage, array $depe
&& !$storage->is_interface
&& !$storage->is_trait
) {
/** @psalm-suppress PropertyTypeCoercion */
$storage->methods['__construct'] = $storage->methods[$fq_classlike_name_lc];
}

Expand Down Expand Up @@ -1144,9 +1143,7 @@ protected function inheritMethodsFromParent(
}
}

/** @psalm-suppress PropertyTypeCoercion */
$storage->declaring_method_ids[$aliased_method_name] = $declaring_method_id;
/** @psalm-suppress PropertyTypeCoercion */
$storage->inheritable_method_ids[$aliased_method_name] = $declaring_method_id;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Codebase/Reflection.php
Expand Up @@ -65,7 +65,6 @@ public function registerClass(\ReflectionClass $reflected_class): void
$storage->abstract = $reflected_class->isAbstract();
$storage->is_interface = $reflected_class->isInterface();

/** @psalm-suppress PropertyTypeCoercion */
$storage->potential_declaring_method_ids['__construct'][$class_name_lower . '::__construct'] = true;

if ($reflected_parent_class) {
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Fork/Pool.php
Expand Up @@ -217,7 +217,6 @@ public function __construct(
} catch (\Throwable $t) {
// This can happen when developing Psalm from source without running `composer update`,
// or because of rare bugs in Psalm.
/** @psalm-suppress MixedArgument on Windows, for some reason */
$process_done_message = new ForkProcessErrorMessage(
$t->getMessage() . "\nStack trace in the forked worker:\n" . $t->getTraceAsString()
);
Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php
Expand Up @@ -54,9 +54,7 @@ public function enterNode(PhpParser\Node $node)
* @psalm-suppress MixedOperand
*/
$node->setAttribute('startFilePos', $attrs['startFilePos'] + $this->file_offset);
/** @psalm-suppress MixedOperand */
$node->setAttribute('endFilePos', $attrs['endFilePos'] + $this->file_offset);
/** @psalm-suppress MixedOperand */
$node->setAttribute('startLine', $attrs['startLine'] + $this->line_offset);
}
}
3 changes: 0 additions & 3 deletions src/Psalm/Internal/PhpVisitor/PartialParserVisitor.php
Expand Up @@ -216,7 +216,6 @@ public function enterNode(PhpParser\Node $node, &$traverseChildren = true)
if ($error->hasColumnInfo()) {
/** @var array{startFilePos: int, endFilePos: int} */
$error_attrs = $error->getAttributes();
/** @psalm-suppress MixedOperand */
$error = new PhpParser\Error(
$error->getRawMessage(),
[
Expand Down Expand Up @@ -297,7 +296,6 @@ public function enterNode(PhpParser\Node $node, &$traverseChildren = true)

$node->setAttribute('comments', $new_comments);

/** @psalm-suppress MixedOperand */
$node->setAttribute('startFilePos', $attrs['startFilePos'] + $start_offset);
} else {
$node->setAttribute('startFilePos', $stmt_start_pos + $start_offset);
Expand All @@ -309,7 +307,6 @@ public function enterNode(PhpParser\Node $node, &$traverseChildren = true)
}

if ($line_offset !== 0) {
/** @psalm-suppress MixedOperand */
$node->setAttribute('startLine', $attrs['startLine'] + $line_offset);
}

Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/PluginManager/ComposerLock.php
Expand Up @@ -57,7 +57,6 @@ public function getPlugins(): array

private function read(string $file_name): array
{
/** @psalm-suppress MixedAssignment */
$contents = json_decode(file_get_contents($file_name), true);

if ($error = json_last_error()) {
Expand Down
4 changes: 0 additions & 4 deletions src/Psalm/Internal/Provider/NodeDataProvider.php
Expand Up @@ -30,13 +30,9 @@ class NodeDataProvider implements \Psalm\NodeTypeProvider

public function __construct()
{
/** @psalm-suppress PropertyTypeCoercion */
$this->node_types = new SplObjectStorage();
/** @psalm-suppress PropertyTypeCoercion */
$this->node_assertions = new SplObjectStorage();
/** @psalm-suppress PropertyTypeCoercion */
$this->node_if_true_assertions = new SplObjectStorage();
/** @psalm-suppress PropertyTypeCoercion */
$this->node_if_false_assertions = new SplObjectStorage();
}

Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Provider/ParserCacheProvider.php
Expand Up @@ -191,7 +191,6 @@ private function getExistingFileContentHashes(): array
return [];
}

/** @psalm-suppress MixedAssignment */
$hashes_decoded = json_decode($hashes_encoded, true);

if (!is_array($hashes_decoded)) {
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Scope/CaseScope.php
Expand Up @@ -26,7 +26,6 @@ public function __construct(Context $parent_context)

public function __destruct()
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->parent_context = null;
}
}
1 change: 0 additions & 1 deletion src/Psalm/IssueBuffer.php
Expand Up @@ -517,7 +517,6 @@ function (IssueData $d1, IssueData $d2) : int {
}
}

/** @psalm-suppress PropertyTypeCoercion due to Psalm bug */
$issues_data[$file_path][$key] = $issue_data;
}
}
Expand Down

0 comments on commit ae04865

Please sign in to comment.