Skip to content

Commit 984a5e6

Browse files
authored
Merge pull request #907 from ruudk/useExperimentalExecutor-conditional
Check if experimental executor exists before trying to set it
2 parents bd69500 + 6a171ef commit 984a5e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Request/Executor.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Executor
3434
private EventDispatcherInterface $dispatcher;
3535
private PromiseAdapter $promiseAdapter;
3636
private ExecutorInterface $executor;
37-
private bool $useExperimentalExecutor;
37+
private bool $useExperimentalExecutor; // TODO: remove in 1.0
3838

3939
/**
4040
* @var callable|null
@@ -46,13 +46,13 @@ public function __construct(
4646
PromiseAdapter $promiseAdapter,
4747
EventDispatcherInterface $dispatcher,
4848
?callable $defaultFieldResolver = null,
49-
bool $useExperimental = false
49+
bool $useExperimental = false // TODO: remove in 1.0
5050
) {
5151
$this->executor = $executor;
5252
$this->promiseAdapter = $promiseAdapter;
5353
$this->dispatcher = $dispatcher;
5454
$this->defaultFieldResolver = $defaultFieldResolver;
55-
$this->useExperimentalExecutor = $useExperimental;
55+
$this->useExperimentalExecutor = $useExperimental; // TODO: remove in 1.0
5656
}
5757

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

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

0 commit comments

Comments
 (0)