Skip to content

Commit

Permalink
Merge pull request #1152 from duncanmcclean/explicit-nullable-param-d…
Browse files Browse the repository at this point in the history
…eclarations

Fixes for implicit nullability deprecation
  • Loading branch information
mfn authored Nov 22, 2024
2 parents 6caf374 + 65d9a0c commit 79da816
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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';

Expand All @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/Support/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Support/PaginationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/Support/SimplePaginationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion tests/Support/Objects/ExamplesAuthorizeMessageQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/Objects/ExamplesAuthorizeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/Traits/MakeCommandAssertionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand Down

0 comments on commit 79da816

Please sign in to comment.