From 29d354efa7929d5e1d5980bb4b92e61f6d059b5a Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Tue, 19 Nov 2024 12:10:48 +0000 Subject: [PATCH 1/3] Add explicit nullable type declaration --- src/Support/Field.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/Field.php b/src/Support/Field.php index c1f81a81..2857afc9 100644 --- a/src/Support/Field.php +++ b/src/Support/Field.php @@ -34,7 +34,7 @@ abstract class Field * @param mixed $root * @param mixed $ctx */ - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return true; } From 983963cb711d97c8cf4d3659349276151c6df2e7 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Tue, 19 Nov 2024 12:11:10 +0000 Subject: [PATCH 2/3] Add another one to a testing trait. --- tests/Support/Traits/MakeCommandAssertionTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Support/Traits/MakeCommandAssertionTrait.php b/tests/Support/Traits/MakeCommandAssertionTrait.php index 05e67597..6bd772c3 100644 --- a/tests/Support/Traits/MakeCommandAssertionTrait.php +++ b/tests/Support/Traits/MakeCommandAssertionTrait.php @@ -18,7 +18,7 @@ protected function assertMakeCommand( string $expectedFilename, string $expectedNamespace, string $expectedClassDefinition, - string $expectedGraphqlName = null + ?string $expectedGraphqlName = null ): void { $filesystemMock = $this ->getMockBuilder(Filesystem::class) From abad634ef25a4bae4db9614e746c0649e247f303 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Tue, 19 Nov 2024 12:21:00 +0000 Subject: [PATCH 3/3] A few more places. --- src/GraphQL.php | 6 +++--- src/Support/PaginationType.php | 2 +- src/Support/SimplePaginationType.php | 2 +- tests/Support/Objects/ExamplesAuthorizeMessageQuery.php | 2 +- tests/Support/Objects/ExamplesAuthorizeQuery.php | 2 +- .../ValidationAndAuthorizationMutation.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/GraphQL.php b/src/GraphQL.php index 69c55763..fdae1846 100644 --- a/src/GraphQL.php +++ b/src/GraphQL.php @@ -227,7 +227,7 @@ public function addTypes(array $types): void /** * @param object|string $class */ - public function addType($class, string $name = null): void + public function addType($class, ?string $name = null): void { if (!$name) { $type = \is_object($class) ? $class : $this->app->make($class); @@ -487,7 +487,7 @@ protected function clearTypeInstances(): void $this->typesInstances = []; } - public function paginate(string $typeName, string $customName = null): Type + public function paginate(string $typeName, ?string $customName = null): Type { $name = $customName ?: $typeName . 'Pagination'; @@ -499,7 +499,7 @@ public function paginate(string $typeName, string $customName = null): Type return $this->typesInstances[$name]; } - public function simplePaginate(string $typeName, string $customName = null): Type + public function simplePaginate(string $typeName, ?string $customName = null): Type { $name = $customName ?: $typeName . 'SimplePagination'; diff --git a/src/Support/PaginationType.php b/src/Support/PaginationType.php index 795a6102..faea86ab 100644 --- a/src/Support/PaginationType.php +++ b/src/Support/PaginationType.php @@ -11,7 +11,7 @@ class PaginationType extends ObjectType { - public function __construct(string $typeName, string $customName = null) + public function __construct(string $typeName, ?string $customName = null) { $name = $customName ?: $typeName . 'Pagination'; diff --git a/src/Support/SimplePaginationType.php b/src/Support/SimplePaginationType.php index 6925e471..a904c112 100644 --- a/src/Support/SimplePaginationType.php +++ b/src/Support/SimplePaginationType.php @@ -11,7 +11,7 @@ class SimplePaginationType extends ObjectType { - public function __construct(string $typeName, string $customName = null) + public function __construct(string $typeName, ?string $customName = null) { $name = $customName ?: $typeName . 'SimplePagination'; diff --git a/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php b/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php index e6f95823..1566e4ef 100644 --- a/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php +++ b/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php @@ -15,7 +15,7 @@ class ExamplesAuthorizeMessageQuery extends Query 'name' => 'Examples authorize query', ]; - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return false; } diff --git a/tests/Support/Objects/ExamplesAuthorizeQuery.php b/tests/Support/Objects/ExamplesAuthorizeQuery.php index c702119b..01985e8a 100644 --- a/tests/Support/Objects/ExamplesAuthorizeQuery.php +++ b/tests/Support/Objects/ExamplesAuthorizeQuery.php @@ -15,7 +15,7 @@ class ExamplesAuthorizeQuery extends Query 'name' => 'Examples authorize query', ]; - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return false; } diff --git a/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php b/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php index 10f0b6ed..68397806 100644 --- a/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php +++ b/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php @@ -14,7 +14,7 @@ class ValidationAndAuthorizationMutation extends Mutation 'name' => 'validationAndAuthorization', ]; - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return 'value1' === $args['arg1']; }