Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problems found by the newest version of PHPStan #1067

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ parameters:
count: 1
path: src/Executor/ReferenceExecutor.php

-
message: "#^Method GraphQL\\\\Language\\\\AST\\\\Node\\:\\:cloneValue\\(\\) should return TCloneable of GraphQL\\\\Language\\\\AST\\\\Location\\|GraphQL\\\\Language\\\\AST\\\\NodeList\\<TNode of GraphQL\\\\Language\\\\AST\\\\Node\\>\\|string\\|TNode of GraphQL\\\\Language\\\\AST\\\\Node but returns GraphQL\\\\Language\\\\AST\\\\Location\\|string\\.$#"
count: 1
path: src/Language/AST/Node.php

-
message: "#^Method GraphQL\\\\Language\\\\AST\\\\Node\\:\\:cloneValue\\(\\) should return TCloneable of GraphQL\\\\Language\\\\AST\\\\Location\\|GraphQL\\\\Language\\\\AST\\\\NodeList\\<TNode of GraphQL\\\\Language\\\\AST\\\\Node\\>\\|string\\|TNode of GraphQL\\\\Language\\\\AST\\\\Node but returns TCloneable of TNode of GraphQL\\\\Language\\\\AST\\\\Node\\.$#"
count: 1
path: src/Language/AST/Node.php

-
message: "#^Unable to resolve the template type TCloneable in call to method static method GraphQL\\\\Language\\\\AST\\\\Node\\:\\:cloneValue\\(\\)$#"
count: 1
Expand All @@ -70,11 +60,6 @@ parameters:
count: 1
path: src/Language/AST/Node.php

-
message: "#^Parameter \\#4 \\$replacement of function array_splice expects array\\|string, array\\<T of GraphQL\\\\Language\\\\AST\\\\Node\\>\\|T of GraphQL\\\\Language\\\\AST\\\\Node\\|null given\\.$#"
count: 1
path: src/Language/AST/NodeList.php

-
message: "#^Parameter \\#1 \\$list of method GraphQL\\\\Language\\\\Printer\\:\\:printList\\(\\) expects GraphQL\\\\Language\\\\AST\\\\NodeList\\<GraphQL\\\\Language\\\\AST\\\\Node\\>, GraphQL\\\\Language\\\\AST\\\\NodeList\\<GraphQL\\\\Language\\\\AST\\\\DefinitionNode&GraphQL\\\\Language\\\\AST\\\\Node\\> given\\.$#"
count: 1
Expand Down
18 changes: 8 additions & 10 deletions src/Error/FormattedError.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,14 @@ public static function toSafeTrace(Throwable $error): array
$safeErr['line'] = $err['line'];
}

if (isset($err['function'])) {
$func = $err['function'];
$args = array_map([self::class, 'printVar'], $err['args'] ?? []);
$funcStr = $func . '(' . implode(', ', $args) . ')';

if (isset($err['class'])) {
$safeErr['call'] = $err['class'] . '::' . $funcStr;
} else {
$safeErr['function'] = $funcStr;
}
$func = $err['function'];
$args = array_map([self::class, 'printVar'], $err['args'] ?? []);
$funcStr = $func . '(' . implode(', ', $args) . ')';

if (isset($err['class'])) {
$safeErr['call'] = $err['class'] . '::' . $funcStr;
} else {
$safeErr['function'] = $funcStr;
}

$formatted[] = $safeErr;
Expand Down
1 change: 0 additions & 1 deletion src/Type/Definition/EnumType.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ public function assertValid(): void
Utils::assertValidName($this->name);

$values = $this->config['values'] ?? null;
// @phpstan-ignore-next-line should not happen if used correctly
if (! is_iterable($values) && ! is_callable($values)) {
$notIterable = Utils::printSafe($values);

Expand Down
1 change: 0 additions & 1 deletion src/Type/Definition/InputObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public function assertValid(): void
$fields = $fields();
}

// @phpstan-ignore-next-line should not happen if used correctly
if (! is_iterable($fields)) {
$invalidFields = Utils::printSafe($fields);

Expand Down
1 change: 0 additions & 1 deletion src/Type/Definition/UnionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function getTypes(): array
$types = $types();
}

// @phpstan-ignore-next-line should not happen if used correctly
if (! is_iterable($types)) {
throw new InvariantViolation(
"Must provide iterable of types or a callable which returns such an iterable for Union {$this->name}."
Expand Down