Skip to content

Commit d3b96a1

Browse files
committed
fix
1 parent 9877055 commit d3b96a1

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Tests/Parser/ParserTest.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,20 @@ public function testParser($query, $structure)
303303
public function queryProvider()
304304
{
305305
return [
306+
[
307+
'{ test (id: -5) { id } } ',
308+
[
309+
'queries' => [
310+
new Query('test', null, [
311+
new Argument('id', new Literal(-5))
312+
], [
313+
new Field('id'),
314+
])
315+
],
316+
'mutations' => [],
317+
'fragments' => []
318+
]
319+
],
306320
[
307321
'query CheckTypeOfLuke {
308322
hero(episode: EMPIRE) {
@@ -474,4 +488,4 @@ public function queryProvider()
474488
];
475489
}
476490

477-
}
491+
}

src/Parser/Tokenizer.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ protected function getKeyword($name)
225225
protected function scanNumber()
226226
{
227227
$start = $this->pos;
228-
228+
if ($this->source[$this->pos] === '-') {
229+
++$this->pos;
230+
}
229231

230232
$this->skipInteger();
231233

@@ -337,4 +339,4 @@ protected function createUnexpected(Token $token)
337339

338340
return new SyntaxErrorException('Unexpected token');
339341
}
340-
}
342+
}

0 commit comments

Comments
 (0)