Skip to content

Commit

Permalink
make DocumentAST::$hash not nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ka committed Sep 20, 2024
1 parent c8eb73d commit 289f80a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ protected function parseQuery(string $query): DocumentNode
*/
protected function validateCacheableRules(
SchemaType $schema,
?string $schemaHash,
string $schemaHash,
DocumentNode $query,
?string $queryHash,
): array {
Expand All @@ -409,7 +409,7 @@ protected function validateCacheableRules(

$cacheConfig = $this->configRepository->get('lighthouse.validation_cache');

if ($schemaHash === null || $queryHash === null || ! ($cacheConfig['enable'] ?? false)) {
if ($queryHash === null || ! ($cacheConfig['enable'] ?? false)) {
return DocumentValidator::validate($schema, $query, $validationRules);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Schema/AST/DocumentAST.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DocumentAST implements Arrayable
public array $schemaExtensions = [];

/** A hash of the schema. */
public ?string $hash = null;
public string $hash;

/** Create a new DocumentAST instance from a schema. */
public static function fromSource(string $schema): self
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/SchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function schema(): Schema
);
}

public function schemaHash(): ?string
public function schemaHash(): string
{
return $this->astBuilder->documentAST()->hash;
}
Expand Down

0 comments on commit 289f80a

Please sign in to comment.