Skip to content

Commit 68dbf8a

Browse files
authored
fix: allow to have queryplans with different options (#1241)
1 parent 3c0d640 commit 68dbf8a

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

src/Type/Definition/ResolveInfo.php

+8-17
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ class ResolveInfo
110110
*/
111111
public array $variableValues = [];
112112

113-
/**
114-
* Lazily initialized.
115-
*/
116-
private QueryPlan $queryPlan;
117-
118113
/**
119114
* @param \ArrayObject<int, FieldNode> $fieldNodes
120115
* @param array<int, string|int> $path
@@ -207,18 +202,14 @@ public function getFieldSelection(int $depth = 0): array
207202
*/
208203
public function lookAhead(array $options = []): QueryPlan
209204
{
210-
if (! isset($this->queryPlan)) {
211-
$this->queryPlan = new QueryPlan(
212-
$this->parentType,
213-
$this->schema,
214-
$this->fieldNodes,
215-
$this->variableValues,
216-
$this->fragments,
217-
$options
218-
);
219-
}
220-
221-
return $this->queryPlan;
205+
return new QueryPlan(
206+
$this->parentType,
207+
$this->schema,
208+
$this->fieldNodes,
209+
$this->variableValues,
210+
$this->fragments,
211+
$options
212+
);
222213
}
223214

224215
/**

tests/Server/QueryExecutionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function testDebugExceptions(): void
117117
$result = $this->executeQuery($query)->toArray();
118118
self::assertArraySubset($expected, $result);
119119

120-
self::assertEquals(44, $result['errors'][0]['extensions']['line'] ?? null);
120+
self::assertEquals(38, $result['errors'][0]['extensions']['line'] ?? null);
121121

122122
self::assertStringContainsString('tests/Server/ServerTestCase.php', $result['errors'][0]['extensions']['file'] ?? '');
123123
}

0 commit comments

Comments
 (0)