Skip to content

Commit 7d1da83

Browse files
authored
Merge pull request #1635 from webonyx/renovate/major-phpstan
chore(deps): update phpstan packages to v2 (major)
2 parents ed6b5cc + c515359 commit 7d1da83

38 files changed

+156
-90
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"nyholm/psr7": "^1.5",
2424
"phpbench/phpbench": "^1.2",
2525
"phpstan/extension-installer": "^1.1",
26-
"phpstan/phpstan": "1.12.12",
27-
"phpstan/phpstan-phpunit": "1.4.1",
28-
"phpstan/phpstan-strict-rules": "1.6.1",
26+
"phpstan/phpstan": "2.1.8",
27+
"phpstan/phpstan-phpunit": "2.0.4",
28+
"phpstan/phpstan-strict-rules": "2.0.3",
2929
"phpunit/phpunit": "^9.5 || ^10.5.21 || ^11",
3030
"psr/http-message": "^1 || ^2",
3131
"react/http": "^1.6",
3232
"react/promise": "^2.0 || ^3.0",
33-
"rector/rector": "^1.0",
33+
"rector/rector": "^2.0",
3434
"symfony/polyfill-php81": "^1.23",
3535
"symfony/var-exporter": "^5 || ^6 || ^7",
3636
"thecodingmachine/safe": "^1.3 || ^2"

generate-class-reference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
];
4040

4141
/**
42-
* @param ReflectionClass<object> $class
42+
* @param ReflectionClass<covariant object> $class
4343
* @param array{constants?: bool, props?: bool, methods?: bool} $options
4444
*
4545
* @throws ExceptionInterface

phpstan-baseline.neon

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,91 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Unable to resolve the template type TCloneable in call to method static method GraphQL\\\\Language\\\\AST\\\\Node\\:\\:cloneValue\\(\\)$#"
4+
message: '#^Unable to resolve the template type TCloneable in call to method static method GraphQL\\Language\\AST\\Node\:\:cloneValue\(\)$#'
5+
identifier: argument.templateType
56
count: 1
67
path: src/Language/AST/Node.php
78

89
-
9-
message: "#^Variable property access on TCloneable of TNode of GraphQL\\\\Language\\\\AST\\\\Node\\.$#"
10+
message: '#^Variable property access on TCloneable of TNode of GraphQL\\Language\\AST\\Node\.$#'
11+
identifier: property.dynamicName
1012
count: 1
1113
path: src/Language/AST/Node.php
1214

1315
-
14-
message: "#^Variable property access on GraphQL\\\\Language\\\\AST\\\\Node\\.$#"
16+
message: '#^Variable property access on GraphQL\\Language\\AST\\Node\.$#'
17+
identifier: property.dynamicName
1518
count: 1
1619
path: src/Language/Visitor.php
1720

1821
-
19-
message: "#^Variable property access on GraphQL\\\\Language\\\\AST\\\\Node\\|null\\.$#"
22+
message: '#^Variable property access on GraphQL\\Language\\AST\\Node\|null\.$#'
23+
identifier: property.dynamicName
2024
count: 1
2125
path: src/Language/Visitor.php
2226

2327
-
24-
message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\Argument constructor expects array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\InputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\InputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), defaultValue\\?\\: mixed, description\\?\\: string\\|null, deprecationReason\\?\\: string\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\InputValueDefinitionNode\\|null\\}, non\\-empty\\-array given\\.$#"
25-
count: 1
26-
path: src/Type/Definition/Argument.php
27-
28-
-
29-
message: "#^Property GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\:\\:\\$interfaces \\(array\\<int, GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>\\) does not accept array\\<int, GraphQL\\\\Type\\\\Definition\\\\Type\\>\\.$#"
28+
message: '#^Property GraphQL\\Type\\Definition\\InterfaceType\:\:\$interfaces \(array\<int, GraphQL\\Type\\Definition\\InterfaceType\>\) does not accept array\<int, GraphQL\\Type\\Definition\\Type\>\.$#'
29+
identifier: assign.propertyType
3030
count: 1
3131
path: src/Type/Definition/InterfaceType.php
3232

3333
-
34-
message: "#^Unable to resolve the template type T in call to method static method GraphQL\\\\Type\\\\Schema\\:\\:resolveType\\(\\)$#"
34+
message: '#^Unable to resolve the template type T in call to method static method GraphQL\\Type\\Schema\:\:resolveType\(\)$#'
35+
identifier: argument.templateType
3536
count: 1
3637
path: src/Type/Definition/InterfaceType.php
3738

3839
-
39-
message: "#^Property GraphQL\\\\Type\\\\Definition\\\\ObjectType\\:\\:\\$interfaces \\(array\\<int, GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>\\) does not accept array\\<int, GraphQL\\\\Type\\\\Definition\\\\Type\\>\\.$#"
40+
message: '#^Property GraphQL\\Type\\Definition\\ObjectType\:\:\$interfaces \(array\<int, GraphQL\\Type\\Definition\\InterfaceType\>\) does not accept array\<int, GraphQL\\Type\\Definition\\Type\>\.$#'
41+
identifier: assign.propertyType
4042
count: 1
4143
path: src/Type/Definition/ObjectType.php
4244

4345
-
44-
message: "#^Unable to resolve the template type T in call to method static method GraphQL\\\\Type\\\\Schema\\:\\:resolveType\\(\\)$#"
46+
message: '#^Unable to resolve the template type T in call to method static method GraphQL\\Type\\Schema\:\:resolveType\(\)$#'
47+
identifier: argument.templateType
4548
count: 1
4649
path: src/Type/Definition/ObjectType.php
4750

4851
-
49-
message: "#^Method GraphQL\\\\Type\\\\Definition\\\\UnionType\\:\\:getTypes\\(\\) should return array\\<int, GraphQL\\\\Type\\\\Definition\\\\ObjectType\\> but returns array\\<int, GraphQL\\\\Type\\\\Definition\\\\Type\\>\\.$#"
52+
message: '#^Method GraphQL\\Type\\Definition\\UnionType\:\:getTypes\(\) should return array\<int, GraphQL\\Type\\Definition\\ObjectType\> but returns array\<int, GraphQL\\Type\\Definition\\Type\>\.$#'
53+
identifier: return.type
5054
count: 1
5155
path: src/Type/Definition/UnionType.php
5256

5357
-
54-
message: "#^Property GraphQL\\\\Type\\\\Definition\\\\UnionType\\:\\:\\$types \\(array\\<int, GraphQL\\\\Type\\\\Definition\\\\ObjectType\\>\\) does not accept array\\<int, GraphQL\\\\Type\\\\Definition\\\\Type\\>\\.$#"
58+
message: '#^Property GraphQL\\Type\\Definition\\UnionType\:\:\$types \(array\<int, GraphQL\\Type\\Definition\\ObjectType\>\) does not accept array\<int, GraphQL\\Type\\Definition\\Type\>\.$#'
59+
identifier: assign.propertyType
5560
count: 1
5661
path: src/Type/Definition/UnionType.php
5762

5863
-
59-
message: "#^Unable to resolve the template type T in call to method static method GraphQL\\\\Type\\\\Schema\\:\\:resolveType\\(\\)$#"
64+
message: '#^Unable to resolve the template type T in call to method static method GraphQL\\Type\\Schema\:\:resolveType\(\)$#'
65+
identifier: argument.templateType
6066
count: 1
6167
path: src/Type/Definition/UnionType.php
6268

6369
-
64-
message: "#^Method GraphQL\\\\Type\\\\Schema\\:\\:resolveType\\(\\) should return T of GraphQL\\\\Type\\\\Definition\\\\Type but returns \\(callable&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\|T of GraphQL\\\\Type\\\\Definition\\\\Type\\.$#"
70+
message: '#^Method GraphQL\\Type\\Schema\:\:resolveType\(\) should return T of GraphQL\\Type\\Definition\\Type but returns \(callable&GraphQL\\Type\\Definition\\Type\)\|T of GraphQL\\Type\\Definition\\Type\.$#'
71+
identifier: return.type
6572
count: 1
6673
path: src/Type/Schema.php
6774

6875
-
69-
message: "#^Variable property access on GraphQL\\\\Language\\\\AST\\\\ArgumentNode\\|GraphQL\\\\Language\\\\AST\\\\BooleanValueNode\\|GraphQL\\\\Language\\\\AST\\\\DirectiveDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\DirectiveNode\\|GraphQL\\\\Language\\\\AST\\\\DocumentNode\\|GraphQL\\\\Language\\\\AST\\\\EnumTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\EnumTypeExtensionNode\\|GraphQL\\\\Language\\\\AST\\\\EnumValueDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\EnumValueNode\\|GraphQL\\\\Language\\\\AST\\\\FieldDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\FieldNode\\|GraphQL\\\\Language\\\\AST\\\\FloatValueNode\\|GraphQL\\\\Language\\\\AST\\\\FragmentDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\FragmentSpreadNode\\|GraphQL\\\\Language\\\\AST\\\\InlineFragmentNode\\|GraphQL\\\\Language\\\\AST\\\\InputObjectTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\InputObjectTypeExtensionNode\\|GraphQL\\\\Language\\\\AST\\\\InputValueDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\InterfaceTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\InterfaceTypeExtensionNode\\|GraphQL\\\\Language\\\\AST\\\\IntValueNode\\|GraphQL\\\\Language\\\\AST\\\\ListTypeNode\\|GraphQL\\\\Language\\\\AST\\\\ListValueNode\\|GraphQL\\\\Language\\\\AST\\\\NamedTypeNode\\|GraphQL\\\\Language\\\\AST\\\\NameNode\\|GraphQL\\\\Language\\\\AST\\\\NonNullTypeNode\\|GraphQL\\\\Language\\\\AST\\\\NullValueNode\\|GraphQL\\\\Language\\\\AST\\\\ObjectFieldNode\\|GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\ObjectTypeExtensionNode\\|GraphQL\\\\Language\\\\AST\\\\ObjectValueNode\\|GraphQL\\\\Language\\\\AST\\\\OperationDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\OperationTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\ScalarTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\ScalarTypeExtensionNode\\|GraphQL\\\\Language\\\\AST\\\\SchemaDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\SelectionSetNode\\|GraphQL\\\\Language\\\\AST\\\\StringValueNode\\|GraphQL\\\\Language\\\\AST\\\\UnionTypeDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\UnionTypeExtensionNode\\|GraphQL\\\\Language\\\\AST\\\\VariableDefinitionNode\\|GraphQL\\\\Language\\\\AST\\\\VariableNode\\.$#"
76+
message: '#^Variable property access on GraphQL\\Language\\AST\\ArgumentNode\|GraphQL\\Language\\AST\\BooleanValueNode\|GraphQL\\Language\\AST\\DirectiveDefinitionNode\|GraphQL\\Language\\AST\\DirectiveNode\|GraphQL\\Language\\AST\\DocumentNode\|GraphQL\\Language\\AST\\EnumTypeDefinitionNode\|GraphQL\\Language\\AST\\EnumTypeExtensionNode\|GraphQL\\Language\\AST\\EnumValueDefinitionNode\|GraphQL\\Language\\AST\\EnumValueNode\|GraphQL\\Language\\AST\\FieldDefinitionNode\|GraphQL\\Language\\AST\\FieldNode\|GraphQL\\Language\\AST\\FloatValueNode\|GraphQL\\Language\\AST\\FragmentDefinitionNode\|GraphQL\\Language\\AST\\FragmentSpreadNode\|GraphQL\\Language\\AST\\InlineFragmentNode\|GraphQL\\Language\\AST\\InputObjectTypeDefinitionNode\|GraphQL\\Language\\AST\\InputObjectTypeExtensionNode\|GraphQL\\Language\\AST\\InputValueDefinitionNode\|GraphQL\\Language\\AST\\InterfaceTypeDefinitionNode\|GraphQL\\Language\\AST\\InterfaceTypeExtensionNode\|GraphQL\\Language\\AST\\IntValueNode\|GraphQL\\Language\\AST\\ListTypeNode\|GraphQL\\Language\\AST\\ListValueNode\|GraphQL\\Language\\AST\\NamedTypeNode\|GraphQL\\Language\\AST\\NameNode\|GraphQL\\Language\\AST\\NonNullTypeNode\|GraphQL\\Language\\AST\\NullValueNode\|GraphQL\\Language\\AST\\ObjectFieldNode\|GraphQL\\Language\\AST\\ObjectTypeDefinitionNode\|GraphQL\\Language\\AST\\ObjectTypeExtensionNode\|GraphQL\\Language\\AST\\ObjectValueNode\|GraphQL\\Language\\AST\\OperationDefinitionNode\|GraphQL\\Language\\AST\\OperationTypeDefinitionNode\|GraphQL\\Language\\AST\\ScalarTypeDefinitionNode\|GraphQL\\Language\\AST\\ScalarTypeExtensionNode\|GraphQL\\Language\\AST\\SchemaDefinitionNode\|GraphQL\\Language\\AST\\SelectionSetNode\|GraphQL\\Language\\AST\\StringValueNode\|GraphQL\\Language\\AST\\UnionTypeDefinitionNode\|GraphQL\\Language\\AST\\UnionTypeExtensionNode\|GraphQL\\Language\\AST\\VariableDefinitionNode\|GraphQL\\Language\\AST\\VariableNode\.$#'
77+
identifier: property.dynamicName
7078
count: 1
7179
path: src/Utils/AST.php
7280

7381
-
74-
message: "#^Variable property access on mixed\\.$#"
82+
message: '#^Variable property access on mixed\.$#'
83+
identifier: property.dynamicName
7584
count: 1
7685
path: src/Utils/AST.php
7786

7887
-
79-
message: "#^Method GraphQL\\\\Validator\\\\Rules\\\\KnownDirectives\\:\\:getDirectiveLocationForASTPath\\(\\) has parameter \\$ancestors with generic class GraphQL\\\\Language\\\\AST\\\\NodeList but does not specify its types\\: T$#"
88+
message: '#^Method GraphQL\\Validator\\Rules\\KnownDirectives\:\:getDirectiveLocationForASTPath\(\) has parameter \$ancestors with generic class GraphQL\\Language\\AST\\NodeList but does not specify its types\: T$#'
89+
identifier: missingType.generics
8090
count: 1
8191
path: src/Validator/Rules/KnownDirectives.php
82-
83-
-
84-
message: "#^Method GraphQL\\\\Validator\\\\Rules\\\\OverlappingFieldsCanBeMerged\\:\\:getFieldsAndFragmentNames\\(\\) should return array\\{array\\<string, array\\<int, array\\{GraphQL\\\\Type\\\\Definition\\\\Type, GraphQL\\\\Language\\\\AST\\\\FieldNode, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition\\|null\\}\\>\\>, array\\<int, string\\>\\} but returns array\\{mixed, array\\<int, int\\|string\\>\\}\\.$#"
85-
count: 1
86-
path: src/Validator/Rules/OverlappingFieldsCanBeMerged.php
87-
88-
-
89-
message: "#^SplObjectStorage\\<GraphQL\\\\Language\\\\AST\\\\SelectionSetNode, array\\{array\\<string, array\\<int, array\\{GraphQL\\\\Type\\\\Definition\\\\Type, GraphQL\\\\Language\\\\AST\\\\FieldNode, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition\\|null\\}\\>\\>, array\\<int, string\\>\\}\\> does not accept array\\<int, mixed\\>\\.$#"
90-
count: 1
91-
path: src/Validator/Rules/OverlappingFieldsCanBeMerged.php

phpstan/include-by-php-version.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
if (version_compare($phpversion, '8.2', '>=')) {
77
$includes[] = __DIR__ . '/php-at-least-8.2.neon';
88
}
9+
if (version_compare($phpversion, '8.4', '<')) {
10+
$includes[] = __DIR__ . '/php-below-8.4.neon';
11+
}
12+
if (version_compare($phpversion, '8.2', '<')) {
13+
$includes[] = __DIR__ . '/php-below-8.2.neon';
14+
}
915
if (version_compare($phpversion, '8.1', '<')) {
1016
$includes[] = __DIR__ . '/php-below-8.1.neon';
1117
}

phpstan/php-below-8.2.neon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
identifier: function.alreadyNarrowedType
5+
count: 2
6+
path: ../src/Type/Definition/QueryPlan.php
7+
8+
-
9+
identifier: function.alreadyNarrowedType
10+
count: 2
11+
path: ../src/Utils/TypeInfo.php

phpstan/php-below-8.4.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Call\-site variance of covariant object in generic type ReflectionClass\<covariant object\> in PHPDoc tag @param for parameter \$class is redundant, template type T of object of class ReflectionClass has the same variance\.$#'
5+
identifier: generics.callSiteVarianceRedundant
6+
count: 1
7+
path: ../generate-class-reference.php

src/Error/Error.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function __construct(
9393

9494
// Compute list of blame nodes.
9595
if ($nodes instanceof \Traversable) {
96+
/** @phpstan-ignore arrayFilter.strict */
9697
$this->nodes = array_filter(\iterator_to_array($nodes));
9798
} elseif (\is_array($nodes)) {
9899
$this->nodes = array_filter($nodes);

src/Executor/ExecutionContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ExecutionContext
4949
*/
5050
public $argsMapper;
5151

52-
/** @var array<int, Error> */
52+
/** @var list<Error> */
5353
public array $errors;
5454

5555
public PromiseAdapter $promiseAdapter;
@@ -59,7 +59,7 @@ class ExecutionContext
5959
* @param mixed $rootValue
6060
* @param mixed $contextValue
6161
* @param array<string, mixed> $variableValues
62-
* @param array<int, Error> $errors
62+
* @param list<Error> $errors
6363
*
6464
* @phpstan-param FieldResolver $fieldResolver
6565
*/

src/Executor/ExecutionResult.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public function toArray(int $debug = DebugFlag::NONE): array
161161
$errorsHandler = $this->errorsHandler
162162
?? static fn (array $errors, callable $formatter): array => \array_map($formatter, $errors);
163163

164+
/** @phpstan-var SerializableErrors */
164165
$handledErrors = $errorsHandler(
165166
$this->errors,
166167
FormattedError::prepareFormatter($this->errorFormatter, $debug)

src/Executor/Promise/Adapter/AmpPromiseAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function all(iterable $promisesOrValues): Promise
126126

127127
/**
128128
* @template TArgument
129-
* @template TResult
129+
* @template TResult of AmpPromise<mixed>
130130
*
131131
* @param Deferred<TResult> $deferred
132132
* @param callable(TArgument): TResult $callback

0 commit comments

Comments
 (0)