Skip to content

Commit ff54b69

Browse files
committed
fix: Initial return type fixes
+ Fix MyException to use GraphQLInterface
1 parent 1d1436c commit ff54b69

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

Mappers/RequestParameter.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ class RequestParameter implements ParameterInterface
1515
/**
1616
* @param array<string, mixed> $args
1717
* @param mixed $context
18-
*
19-
* @return mixed
2018
*/
21-
public function resolve(?object $source, array $args, $context, ResolveInfo $info)
19+
public function resolve(?object $source, array $args, $context, ResolveInfo $info): mixed
2220
{
2321
if (!$context instanceof SymfonyRequestContextInterface) {
2422
throw new GraphQLException('Cannot type-hint on a Symfony Request object in your query/mutation/field. The request context must implement SymfonyRequestContextInterface.');

Server/ServerConfig.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ class ServerConfig extends \GraphQL\Server\ServerConfig
2020
*
2121
* @param ValidationRule[]|callable $validationRules
2222
*
23-
* @return \GraphQL\Server\ServerConfig
24-
*
2523
* @api
2624
*/
27-
public function setValidationRules($validationRules)
25+
public function setValidationRules($validationRules): \GraphQL\Server\ServerConfig
2826
{
2927
parent::setValidationRules(
3028
function (OperationParams $params, DocumentNode $doc, string $operationType) use ($validationRules): array {

Tests/Fixtures/Controller/MyException.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,23 @@
44
namespace TheCodingMachine\GraphQLite\Bundle\Tests\Fixtures\Controller;
55

66

7-
use GraphQL\Error\ClientAware;
7+
use TheCodingMachine\GraphQLite\Exceptions\GraphQLExceptionInterface;
88

9-
class MyException extends \Exception implements ClientAware
9+
class MyException extends \Exception implements GraphQLExceptionInterface
1010
{
1111

1212
/**
1313
* Returns true when exception message is safe to be displayed to a client.
1414
*
15-
* @return bool
16-
*
1715
* @api
1816
*/
19-
public function isClientSafe()
17+
public function isClientSafe(): bool
2018
{
2119
return true;
2220
}
2321

24-
/**
25-
* Returns string describing a category of the error.
26-
*
27-
* Value "graphql" is reserved for errors produced by query parsing or validation, do not use it.
28-
*
29-
* @return string
30-
*
31-
* @api
32-
*/
33-
public function getCategory()
22+
public function getExtensions(): array
3423
{
35-
return 'foobar';
24+
return ['category' => 'foobar'];
3625
}
3726
}

0 commit comments

Comments
 (0)