Skip to content

Commit 94e4db3

Browse files
authored
Increase PHPStan analysis level to max (#118)
1 parent 9d39832 commit 94e4db3

File tree

108 files changed

+178
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+178
-17
lines changed

examples/custom-types/expected/Operations/MyBenSampoEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/custom-types/expected/Operations/MyBenSampoEnumQuery/MyBenSampoEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/custom-types/expected/Operations/MyCarbonDateQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static function execute($value): MyCarbonDateQuery\MyCarbonDateQueryResul
1919

2020
protected static function converters(): array
2121
{
22+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2223
static $converters;
2324

2425
return $converters ??= [

examples/custom-types/expected/Operations/MyCarbonDateQuery/MyCarbonDateQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($withCarbonDate): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/custom-types/expected/Operations/MyCustomEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/custom-types/expected/Operations/MyCustomEnumQuery/MyCustomEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/custom-types/expected/Operations/MyCustomObjectQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/custom-types/expected/Operations/MyCustomObjectQuery/MyCustomObjectQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/custom-types/expected/Operations/MyDefaultDateQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static function execute($value): MyDefaultDateQuery\MyDefaultDateQueryRes
1919

2020
protected static function converters(): array
2121
{
22+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2223
static $converters;
2324

2425
return $converters ??= [

examples/custom-types/expected/Operations/MyDefaultDateQuery/MyDefaultDateQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($withDefaultDate): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/custom-types/expected/Operations/MyDefaultEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static function execute($value): MyDefaultEnumQuery\MyDefaultEnumQueryRes
1919

2020
protected static function converters(): array
2121
{
22+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2223
static $converters;
2324

2425
return $converters ??= [

examples/custom-types/expected/Operations/MyDefaultEnumQuery/MyDefaultEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($withDefaultEnum): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/custom-types/expected/Operations/MyEnumInputQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/custom-types/expected/Operations/MyEnumInputQuery/MyEnumInputQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/custom-types/expected/Operations/MyEnumInputQuery/WithEnumInput/EnumObject.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static function make(
3232

3333
protected function converters(): array
3434
{
35+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
3536
static $converters;
3637

3738
return $converters ??= [

examples/custom-types/expected/Operations/MyNativeEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/custom-types/expected/Operations/MyNativeEnumQuery/MyNativeEnumQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/custom-types/expected/Operations/MyNestedCustomObjectQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static function execute(): MyNestedCustomObjectQuery\MyNestedCustomObject
1515

1616
protected static function converters(): array
1717
{
18+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
1819
static $converters;
1920

2021
return $converters ??= [

examples/custom-types/expected/Operations/MyNestedCustomObjectQuery/MyNestedCustomObjectQuery.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/custom-types/expected/Operations/MyNestedCustomObjectQuery/WithNestedCustomObject/NestedCustomObject.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static function make(
3232

3333
protected function converters(): array
3434
{
35+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
3536
static $converters;
3637

3738
return $converters ??= [

examples/custom-types/expected/TypeConverters/CustomInputConverter.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ public function fromGraphQL($value): \Spawnia\Sailor\CustomTypesSrc\CustomObject
1414
throw new \InvalidArgumentException('Did not find expected property foo.');
1515
}
1616

17-
return new \Spawnia\Sailor\CustomTypesSrc\CustomObject($value->foo);
17+
$foo = $value->foo;
18+
if (! is_string($foo)) {
19+
$fooType = gettype($foo);
20+
throw new \InvalidArgumentException("Expected foo to be string, got: {$fooType}.");
21+
}
22+
23+
return new \Spawnia\Sailor\CustomTypesSrc\CustomObject($foo);
1824
}
1925

2026
public function toGraphQL($value)

examples/custom-types/expected/TypeConverters/CustomOutputConverter.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ public function fromGraphQL($value): \Spawnia\Sailor\CustomTypesSrc\CustomObject
1414
throw new \InvalidArgumentException('Did not find expected property foo.');
1515
}
1616

17-
return new \Spawnia\Sailor\CustomTypesSrc\CustomObject($value->foo);
17+
$foo = $value->foo;
18+
if (! is_string($foo)) {
19+
$fooType = gettype($foo);
20+
throw new \InvalidArgumentException("Expected foo to be string, got: {$fooType}.");
21+
}
22+
23+
return new \Spawnia\Sailor\CustomTypesSrc\CustomObject($foo);
1824
}
1925

2026
public function toGraphQL($value)

examples/custom-types/expected/Types/EnumInput.php

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static function make(
3030

3131
protected function converters(): array
3232
{
33+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
3334
static $converters;
3435

3536
return $converters ??= [

examples/custom-types/src/CustomObjectTypeConfig.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ protected function decorateTypeConverterClass(Type $type, ClassType $class, Meth
6262
throw new \InvalidArgumentException('Did not find expected property foo.');
6363
}
6464
65-
return new \\{$customObjectClass}(\$value->foo);
65+
\$foo = \$value->foo;
66+
if (! is_string(\$foo)) {
67+
\$fooType = gettype(\$foo);
68+
throw new \InvalidArgumentException("Expected foo to be string, got: {\$fooType}.");
69+
}
70+
71+
return new \\{$customObjectClass}(\$foo);
6672
PHP);
6773

6874
$toGraphQL->setBody(<<<PHP

examples/input/expected/Operations/TakeList.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/input/expected/Operations/TakeList/TakeList.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/input/expected/Operations/TakeSomeInput.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static function execute(
2020

2121
protected static function converters(): array
2222
{
23+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2324
static $converters;
2425

2526
return $converters ??= [

examples/input/expected/Operations/TakeSomeInput/TakeSomeInput.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/input/expected/Types/SomeInput.php

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static function make(
4242

4343
protected function converters(): array
4444
{
45+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
4546
static $converters;
4647

4748
return $converters ??= [

examples/php-keywords/expected/Operations/AllCases.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static function execute(): AllCases\AllCasesResult
1515

1616
protected static function converters(): array
1717
{
18+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
1819
static $converters;
1920

2021
return $converters ??= [

examples/php-keywords/expected/Operations/AllCases/AllCases.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($cases): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/php-keywords/expected/Operations/AllCases/Cases/_Case.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($id): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/php-keywords/expected/Operations/_Catch.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static function execute(): _Catch\_CatchResult
1515

1616
protected static function converters(): array
1717
{
18+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
1819
static $converters;
1920

2021
return $converters ??= [

examples/php-keywords/expected/Operations/_Catch/_Catch.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/php-keywords/expected/Operations/_Catch/_Print/_Switch.php

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public static function make(
3838

3939
protected function converters(): array
4040
{
41+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
4142
static $converters;
4243

4344
return $converters ??= [

examples/php-keywords/expected/Types/_new.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static function make(
2424

2525
protected function converters(): array
2626
{
27+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2728
static $converters;
2829

2930
return $converters ??= [

examples/polymorphic/expected/Operations/AllMembers.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static function execute(): AllMembers\AllMembersResult
1515

1616
protected static function converters(): array
1717
{
18+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
1819
static $converters;
1920

2021
return $converters ??= [

examples/polymorphic/expected/Operations/AllMembers/AllMembers.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($members): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/polymorphic/expected/Operations/AllMembers/Members/Organization.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($code): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/polymorphic/expected/Operations/AllMembers/Members/User.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function make(
2626

2727
protected function converters(): array
2828
{
29+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2930
static $converters;
3031

3132
return $converters ??= [

examples/polymorphic/expected/Operations/NodeMembers.php

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static function execute(): NodeMembers\NodeMembersResult
1515

1616
protected static function converters(): array
1717
{
18+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
1819
static $converters;
1920

2021
return $converters ??= [

examples/polymorphic/expected/Operations/NodeMembers/Members/Organization.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static function make(): self
1818

1919
protected function converters(): array
2020
{
21+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2122
static $converters;
2223

2324
return $converters ??= [

examples/polymorphic/expected/Operations/NodeMembers/Members/User.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($id): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/polymorphic/expected/Operations/NodeMembers/NodeMembers.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($members): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/polymorphic/expected/Operations/NodeWithFragments.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static function execute($id): NodeWithFragments\NodeWithFragmentsResult
1919

2020
protected static function converters(): array
2121
{
22+
/** @var array<int, array{string, \Spawnia\Sailor\Convert\TypeConverter}>|null $converters */
2223
static $converters;
2324

2425
return $converters ??= [

examples/polymorphic/expected/Operations/NodeWithFragments/Node/Node/Node/Post.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($id): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

examples/polymorphic/expected/Operations/NodeWithFragments/Node/Node/Node/Task.php

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function make($id): self
2525

2626
protected function converters(): array
2727
{
28+
/** @var array<string, \Spawnia\Sailor\Convert\TypeConverter>|null $converters */
2829
static $converters;
2930

3031
return $converters ??= [

0 commit comments

Comments
 (0)