Skip to content

Commit 85d84e4

Browse files
chore(deps): update dependency phpstan/phpstan to v2.1.15 (#1696)
* chore(deps): update dependency phpstan/phpstan to v2.1.15 * Fix rector config * Skip RemoveDataProviderParamKeysRector * American english * Fix PHPStan * Fix PHPStan on PHP 7.4 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benedikt Franke <[email protected]>
1 parent 3d6b098 commit 85d84e4

16 files changed

+30
-26
lines changed

UPGRADE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class MyType extends ScalarType {
422422
### Breaking: Descriptions in comments are not used as descriptions by default anymore
423423

424424
Descriptions now need to be inside Strings or BlockStrings in order to be picked up as
425-
description. If you want to keep the old behaviour you can supply the option `commentDescriptions`
425+
description. If you want to keep the old behavior you can supply the option `commentDescriptions`
426426
to BuildSchema::buildAST(), BuildSchema::build() or Printer::doPrint().
427427

428428
Here is the official way now to define descriptions in the graphQL language:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nyholm/psr7": "^1.5",
2424
"phpbench/phpbench": "^1.2",
2525
"phpstan/extension-installer": "^1.1",
26-
"phpstan/phpstan": "2.1.11",
26+
"phpstan/phpstan": "2.1.15",
2727
"phpstan/phpstan-phpunit": "2.0.6",
2828
"phpstan/phpstan-strict-rules": "2.0.4",
2929
"phpunit/phpunit": "^9.5 || ^10.5.21 || ^11",

rector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector::class, // static methods are fine
2020
Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector::class, // Less efficient
2121
Rector\CodeQuality\Rector\Switch_\SwitchTrueToIfRector::class, // More expressive in some cases
22-
Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector::class, // Sometimes necessary to prove runtime behaviour matches defined types
23-
Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector::class, // Sometimes necessary to prove runtime behaviour matches defined types
22+
Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector::class, // Sometimes necessary to prove runtime behavior matches defined types
23+
Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector::class, // Sometimes necessary to prove runtime behavior matches defined types
2424
Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class, // Sometimes false-positive
2525
Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector::class, // TODO reintroduce when https://github.com/rectorphp/rector-src/pull/4491 is released
2626
Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector::class, // Sometimes nicer for symmetry
2727
Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector::class, // Prefer self::
28-
Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector::class, // imprecise
28+
Rector\PHPUnit\CodeQuality\Rector\Class_\RemoveDataProviderParamKeysRector::class, // Less clear
2929
Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertPropertyExistsRector::class, // Uses deprecated PHPUnit methods
3030
Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector::class => [
3131
__DIR__ . '/tests/Utils/MixedStoreTest.php', // Uses keys that are not string or int

src/Type/Definition/CustomScalarType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ public function assertValid(): void
101101
throw new InvariantViolation("{$this->name} must provide \"parseValue\" and \"parseLiteral\" functions, \"serialize\" function, or both.");
102102
}
103103

104-
// @phpstan-ignore-next-line not necessary according to types, but can happen during runtime
104+
// @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
105105
if ($hasSerialize && ! is_callable($serialize)) {
106106
$notCallable = Utils::printSafe($serialize);
107107
throw new InvariantViolation("{$this->name} must provide \"serialize\" as a callable if given, but got: {$notCallable}.");
108108
}
109109

110-
// @phpstan-ignore-next-line not necessary according to types, but can happen during runtime
110+
// @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
111111
if ($hasParseValue && ! is_callable($parseValue)) {
112112
$notCallable = Utils::printSafe($parseValue);
113113
throw new InvariantViolation("{$this->name} must provide \"parseValue\" as a callable if given, but got: {$notCallable}.");
114114
}
115115

116-
// @phpstan-ignore-next-line not necessary according to types, but can happen during runtime
116+
// @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
117117
if ($hasParseLiteral && ! is_callable($parseLiteral)) {
118118
$notCallable = Utils::printSafe($parseLiteral);
119119
throw new InvariantViolation("{$this->name} must provide \"parseLiteral\" as a callable if given, but got: {$notCallable}.");

src/Type/Definition/EnumType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function assertValid(): void
222222
{
223223
Utils::assertValidName($this->name);
224224

225-
$values = $this->config['values'] ?? null;
225+
$values = $this->config['values'] ?? null; // @phpstan-ignore nullCoalesce.initializedProperty (unnecessary according to types, but can happen during runtime)
226226
if (! is_iterable($values) && ! is_callable($values)) {
227227
$notIterable = Utils::printSafe($values);
228228
throw new InvariantViolation("{$this->name} values must be an iterable or callable, got: {$notIterable}");

src/Type/Definition/FieldDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function assertValid(Type $parentType): void
238238
throw new InvariantViolation("{$parentType->name}.{$this->name} field type must be Output Type but got: {$safeType}.");
239239
}
240240

241-
// @phpstan-ignore-next-line not necessary according to types, but can happen during runtime
241+
// @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
242242
if ($this->resolveFn !== null && ! is_callable($this->resolveFn)) {
243243
$safeResolveFn = Utils::printSafe($this->resolveFn);
244244
throw new InvariantViolation("{$parentType->name}.{$this->name} field resolver must be a function if provided, but got: {$safeResolveFn}.");

src/Type/Definition/InputObjectType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function assertValid(): void
181181
{
182182
Utils::assertValidName($this->name);
183183

184-
$fields = $this->config['fields'] ?? null;
184+
$fields = $this->config['fields'] ?? null; // @phpstan-ignore nullCoalesce.initializedProperty (unnecessary according to types, but can happen during runtime)
185185
if (is_callable($fields)) {
186186
$fields = $fields();
187187
}

src/Type/Definition/InterfaceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function assertValid(): void
8585
Utils::assertValidName($this->name);
8686

8787
$resolveType = $this->config['resolveType'] ?? null;
88-
// @phpstan-ignore-next-line not necessary according to types, but can happen during runtime
88+
// @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
8989
if ($resolveType !== null && ! is_callable($resolveType)) {
9090
$notCallable = Utils::printSafe($resolveType);
9191
throw new InvariantViolation("{$this->name} must provide \"resolveType\" as null or a callable, but got: {$notCallable}.");

src/Type/Definition/NamedTypeImplementation.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
use GraphQL\Error\InvariantViolation;
66

7-
/**
8-
* @see NamedType
9-
*/
7+
/** @see NamedType */
108
trait NamedTypeImplementation
119
{
1210
public string $name;
@@ -21,7 +19,7 @@ public function toString(): string
2119
/** @throws InvariantViolation */
2220
protected function inferName(): string
2321
{
24-
if (isset($this->name)) {
22+
if (isset($this->name)) { // @phpstan-ignore-line property might be uninitialized
2523
return $this->name;
2624
}
2725

src/Type/Definition/ObjectType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function assertValid(): void
154154
Utils::assertValidName($this->name);
155155

156156
$isTypeOf = $this->config['isTypeOf'] ?? null;
157-
// @phpstan-ignore-next-line not necessary according to types, but can happen during runtime
157+
// @phpstan-ignore-next-line unnecessary according to types, but can happen during runtime
158158
if (isset($isTypeOf) && ! is_callable($isTypeOf)) {
159159
$notCallable = Utils::printSafe($isTypeOf);
160160
throw new InvariantViolation("{$this->name} must provide \"isTypeOf\" as null or a callable, but got: {$notCallable}.");

0 commit comments

Comments
 (0)