Skip to content

Commit

Permalink
fix ci for lower deps
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Dec 1, 2024
1 parent 85bd42f commit e1178c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ public function executeParsedQueryRaw(
);

$queryComplexityRule = $validationRules[QueryComplexity::class] ?? null;
assert($queryComplexityRule instanceof QueryComplexity || $queryComplexityRule === null);
$queryComplexity = $queryComplexityRule?->getQueryComplexity();
$queryComplexity = $queryComplexityRule instanceof QueryComplexity
// TODO remove this check when updating the required version of webonyx/graphql-php
&& method_exists($queryComplexityRule, 'getQueryComplexity')
? $queryComplexityRule->getQueryComplexity()
: null;

/** @var array<\Nuwave\Lighthouse\Execution\ExtensionsResponse|null> $extensionsResponses */
$extensionsResponses = (array) $this->eventDispatcher->dispatch(
Expand Down
7 changes: 5 additions & 2 deletions tests/Unit/Schema/Directives/ComplexityDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ public function testDefaultComplexity(): void

$this->assertCount(1, $events);

$event = $events[0];
$this->assertSame(2, $event->queryComplexity);
// TODO remove this check when updating the required version of webonyx/graphql-php
if (method_exists(QueryComplexity::class, 'getQueryComplexity')) {
$event = $events[0];
$this->assertSame(2, $event->queryComplexity);
}
}

public function testKnowsPagination(): void
Expand Down

0 comments on commit e1178c7

Please sign in to comment.