Skip to content

Commit 951d882

Browse files
committed
Fix extend implement interface in Parser
This is part of the update to allow interfaces to implement interfaces. A single extend statement to add an implementation of an interface without field declarations is valid. This was caught by tests and brings in a change from graphql/graphql-js#2084
1 parent 39c2fb6 commit 951d882

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Language/Parser.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,9 @@ private function parseInterfaceTypeExtension() : InterfaceTypeExtensionNode
16271627
$interfaces = $this->parseImplementsInterfaces();
16281628
$directives = $this->parseDirectives(true);
16291629
$fields = $this->parseFieldsDefinition();
1630-
if (count($directives) === 0 &&
1630+
if (
1631+
count($interfaces) === 0 &&
1632+
count($directives) === 0 &&
16311633
count($fields) === 0
16321634
) {
16331635
throw $this->unexpected();
@@ -1636,7 +1638,7 @@ private function parseInterfaceTypeExtension() : InterfaceTypeExtensionNode
16361638
return new InterfaceTypeExtensionNode([
16371639
'name' => $name,
16381640
'directives' => $directives,
1639-
'interfaces' => $interfaces,
1641+
'interfaces' => $interfaces,
16401642
'fields' => $fields,
16411643
'loc' => $this->loc($start),
16421644
]);

0 commit comments

Comments
 (0)