Skip to content

Commit 4834d97

Browse files
authored
Simplify PHPStan error format configuration and shrink baseline (#1778)
1 parent bd8fc3a commit 4834d97

File tree

6 files changed

+11
-31
lines changed

6 files changed

+11
-31
lines changed

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
uses: ramsey/composer-install@v2
3838

3939
- name: Run a static analysis with phpstan/phpstan
40-
run: vendor/bin/phpstan --error-format=checkstyle | cs2pr
40+
run: vendor/bin/phpstan --error-format=github

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ phpstan.neon:
2727
printf "includes:\n - phpstan.neon.dist" > phpstan.neon
2828

2929
.PHONY: stan
30-
stan: ## Runs static analysis with phpstan
30+
stan: ## Runs static analysis with PHPStan
3131
composer stan
3232

33+
.PHONY: baseline
34+
baseline: ## Regenerate the PHPStan baseline
35+
composer baseline
36+
3337
.PHONY: test
34-
test: ## Runs tests with phpunit
38+
test: ## Runs tests with PHPUnit
3539
composer test
3640

3741
.PHONY: bench
38-
bench: ## Runs benchmarks with phpbench
42+
bench: ## Runs benchmarks with PHPBench
3943
composer bench
4044

4145
.PHONY: docs

phpstan-baseline.neon

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Unable to resolve the template type TCloneable in call to static method GraphQL\\Language\\AST\\Node\:\:cloneValue\(\)$#'
5-
identifier: argument.templateType
6-
count: 1
7-
path: src/Language/AST/Node.php
8-
93
-
104
message: '#^Variable property access on TCloneable of TNode of GraphQL\\Language\\AST\\Node\.$#'
115
identifier: property.dynamicName
@@ -30,24 +24,12 @@ parameters:
3024
count: 1
3125
path: src/Type/Definition/InterfaceType.php
3226

33-
-
34-
message: '#^Unable to resolve the template type T in call to static method GraphQL\\Type\\Schema\:\:resolveType\(\)$#'
35-
identifier: argument.templateType
36-
count: 1
37-
path: src/Type/Definition/InterfaceType.php
38-
3927
-
4028
message: '#^Property GraphQL\\Type\\Definition\\ObjectType\:\:\$interfaces \(array\<int, GraphQL\\Type\\Definition\\InterfaceType\>\) does not accept array\<int, GraphQL\\Type\\Definition\\Type\>\.$#'
4129
identifier: assign.propertyType
4230
count: 1
4331
path: src/Type/Definition/ObjectType.php
4432

45-
-
46-
message: '#^Unable to resolve the template type T in call to static method GraphQL\\Type\\Schema\:\:resolveType\(\)$#'
47-
identifier: argument.templateType
48-
count: 1
49-
path: src/Type/Definition/ObjectType.php
50-
5133
-
5234
message: '#^Method GraphQL\\Type\\Definition\\UnionType\:\:getTypes\(\) should return array\<int, GraphQL\\Type\\Definition\\ObjectType\> but returns array\<int, GraphQL\\Type\\Definition\\Type\>\.$#'
5335
identifier: return.type
@@ -60,12 +42,6 @@ parameters:
6042
count: 1
6143
path: src/Type/Definition/UnionType.php
6244

63-
-
64-
message: '#^Unable to resolve the template type T in call to static method GraphQL\\Type\\Schema\:\:resolveType\(\)$#'
65-
identifier: argument.templateType
66-
count: 1
67-
path: src/Type/Definition/UnionType.php
68-
6945
-
7046
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\.$#'
7147
identifier: return.type

src/Language/AST/Node.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected static function cloneValue($value)
7272
if ($value instanceof self) {
7373
$cloned = clone $value;
7474
foreach (get_object_vars($cloned) as $prop => $propValue) {
75-
$cloned->{$prop} = static::cloneValue($propValue);
75+
$cloned->{$prop} = static::cloneValue($propValue); // @phpstan-ignore argument.templateType
7676
}
7777

7878
return $cloned;

src/Type/Definition/ImplementingTypeImplementation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function initializeInterfaces(): void
5656
}
5757

5858
foreach ($interfaces as $interface) {
59-
$this->interfaces[] = Schema::resolveType($interface);
59+
$this->interfaces[] = Schema::resolveType($interface); // @phpstan-ignore argument.templateType
6060
}
6161
}
6262

src/Type/Definition/UnionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getTypes(): array
9999
}
100100

101101
foreach ($types as $type) {
102-
$this->types[] = Schema::resolveType($type);
102+
$this->types[] = Schema::resolveType($type); // @phpstan-ignore argument.templateType
103103
}
104104
}
105105

0 commit comments

Comments
 (0)