Skip to content

Commit f7a9c62

Browse files
vhenzlspawnia
authored andcommitted
Fix problems found by the newest version of PHPStan
1 parent a325afc commit f7a9c62

File tree

5 files changed

+8
-28
lines changed

5 files changed

+8
-28
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ parameters:
5050
count: 1
5151
path: src/Executor/ReferenceExecutor.php
5252

53-
-
54-
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\\.$#"
55-
count: 1
56-
path: src/Language/AST/Node.php
57-
58-
-
59-
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\\.$#"
60-
count: 1
61-
path: src/Language/AST/Node.php
62-
6353
-
6454
message: "#^Unable to resolve the template type TCloneable in call to method static method GraphQL\\\\Language\\\\AST\\\\Node\\:\\:cloneValue\\(\\)$#"
6555
count: 1
@@ -70,11 +60,6 @@ parameters:
7060
count: 1
7161
path: src/Language/AST/Node.php
7262

73-
-
74-
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\\.$#"
75-
count: 1
76-
path: src/Language/AST/NodeList.php
77-
7863
-
7964
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\\.$#"
8065
count: 1

src/Error/FormattedError.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,14 @@ public static function toSafeTrace(Throwable $error): array
291291
$safeErr['line'] = $err['line'];
292292
}
293293

294-
if (isset($err['function'])) {
295-
$func = $err['function'];
296-
$args = array_map([self::class, 'printVar'], $err['args'] ?? []);
297-
$funcStr = $func . '(' . implode(', ', $args) . ')';
298-
299-
if (isset($err['class'])) {
300-
$safeErr['call'] = $err['class'] . '::' . $funcStr;
301-
} else {
302-
$safeErr['function'] = $funcStr;
303-
}
294+
$func = $err['function'];
295+
$args = array_map([self::class, 'printVar'], $err['args'] ?? []);
296+
$funcStr = $func . '(' . implode(', ', $args) . ')';
297+
298+
if (isset($err['class'])) {
299+
$safeErr['call'] = $err['class'] . '::' . $funcStr;
300+
} else {
301+
$safeErr['function'] = $funcStr;
304302
}
305303

306304
$formatted[] = $safeErr;

src/Type/Definition/EnumType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ public function assertValid(): void
196196
Utils::assertValidName($this->name);
197197

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

src/Type/Definition/InputObjectType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ public function assertValid(): void
158158
$fields = $fields();
159159
}
160160

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

src/Type/Definition/UnionType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public function getTypes(): array
9696
$types = $types();
9797
}
9898

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

0 commit comments

Comments
 (0)