Skip to content

Check if experimental executor exists before trying to set it #907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Request/Executor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Executor
private EventDispatcherInterface $dispatcher;
private PromiseAdapter $promiseAdapter;
private ExecutorInterface $executor;
private bool $useExperimentalExecutor;
private bool $useExperimentalExecutor; // TODO: remove in 1.0

/**
* @var callable|null
Expand All @@ -46,13 +46,13 @@ public function __construct(
PromiseAdapter $promiseAdapter,
EventDispatcherInterface $dispatcher,
?callable $defaultFieldResolver = null,
bool $useExperimental = false
bool $useExperimental = false // TODO: remove in 1.0
) {
$this->executor = $executor;
$this->promiseAdapter = $promiseAdapter;
$this->dispatcher = $dispatcher;
$this->defaultFieldResolver = $defaultFieldResolver;
$this->useExperimentalExecutor = $useExperimental;
$this->useExperimentalExecutor = $useExperimental; // TODO: remove in 1.0
}

public function setExecutor(ExecutorInterface $executor): self
Expand Down Expand Up @@ -133,7 +133,10 @@ public function disableIntrospectionQuery(): void
*/
public function execute(?string $schemaName, array $request, $rootValue = null): ExecutionResult
{
$this->useExperimentalExecutor ? GraphQL::useExperimentalExecutor() : GraphQL::useReferenceExecutor();
// TODO: remove following if-block in 1.0
if (method_exists(GraphQL::class, 'useExperimentalExecutor')) {
$this->useExperimentalExecutor ? GraphQL::useExperimentalExecutor() : GraphQL::useReferenceExecutor();
}

$schema = $this->getSchema($schemaName);
/** @var string $schemaName */
Expand Down