Skip to content

Commit a12854e

Browse files
Autofix
1 parent 708c85b commit a12854e

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

docs/class-reference.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ static function executeQuery(
7070
?array $variableValues = null,
7171
?string $operationName = null,
7272
?callable $fieldResolver = null,
73-
?array $validationRules = null
73+
?array $validationRules = null,
74+
?GraphQL\Validator\ValidationCache $cache = null
7475
): GraphQL\Executor\ExecutionResult
7576
```
7677

@@ -98,7 +99,8 @@ static function promiseToExecute(
9899
?array $variableValues = null,
99100
?string $operationName = null,
100101
?callable $fieldResolver = null,
101-
?array $validationRules = null
102+
?array $validationRules = null,
103+
?GraphQL\Validator\ValidationCache $cache = null
102104
): GraphQL\Executor\Promise\Promise
103105
```
104106

@@ -1811,7 +1813,8 @@ static function validate(
18111813
GraphQL\Type\Schema $schema,
18121814
GraphQL\Language\AST\DocumentNode $ast,
18131815
?array $rules = null,
1814-
?GraphQL\Utils\TypeInfo $typeInfo = null
1816+
?GraphQL\Utils\TypeInfo $typeInfo = null,
1817+
?GraphQL\Validator\ValidationCache $cache = null
18151818
): array
18161819
```
18171820

src/Validator/ValidationCache.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ interface ValidationCache
1818
*/
1919
public function isValidated(Schema $schema, DocumentNode $ast): bool;
2020

21-
/**
22-
* Cache validation status for this schema/query.
23-
*/
21+
/** Cache validation status for this schema/query. */
2422
public function markValidated(Schema $schema, DocumentNode $ast): void;
25-
}
23+
}

tests/Executor/ValidationWithCacheTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public function testIsValidationCachedWithAdapter(): void
7878
}
7979
}';
8080

81-
GraphQL::executeQuery( $schema, $query, null, null, null, null, null, null, $cache)->toArray();
81+
GraphQL::executeQuery($schema, $query, null, null, null, null, null, null, $cache)->toArray();
8282

8383
// TODO: use a spy or something to prove that the validation only happens once
84-
$result = GraphQL::executeQuery( $schema, $query, null, null, null, null, null, null, $cache)->toArray();
84+
$result = GraphQL::executeQuery($schema, $query, null, null, null, null, null, null, $cache)->toArray();
8585

8686
$expected = [
8787
'data' => [

tests/PsrValidationCacheAdapter.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,33 @@
1212
final class PsrValidationCacheAdapter implements ValidationCache
1313
{
1414
private const KEY_PREFIX = 'gql_validation_';
15+
1516
private int $ttl;
17+
1618
private CacheInterface $cache;
1719

1820
public function __construct(
19-
CacheInterface $cache,
21+
CacheInterface $cache,
2022
int $ttlSeconds = 300
2123
) {
2224
$this->ttl = $ttlSeconds;
2325
$this->cache = $cache;
2426
}
2527

26-
/**
27-
* @throws InvalidArgumentException
28-
*/
28+
/** @throws InvalidArgumentException */
2929
public function isValidated(Schema $schema, DocumentNode $ast): bool
3030
{
3131
try {
3232
$key = $this->buildKey($schema, $ast);
33+
3334
/** @phpstan-ignore-next-line */
3435
return $this->cache->has($key);
3536
} catch (\Throwable $e) {
3637
return false;
3738
}
3839
}
3940

40-
/**
41-
* @throws InvalidArgumentException
42-
*/
41+
/** @throws InvalidArgumentException */
4342
public function markValidated(Schema $schema, DocumentNode $ast): void
4443
{
4544
try {

0 commit comments

Comments
 (0)