mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-16 20:33:14 +03:00
BUGFIX: expect ->getType() to throw
(cherry picked from commit 62b003643779246403c0fd71d7e7486d94c50835)
This commit is contained in:
parent
59c128c54a
commit
22cee49747
@ -513,7 +513,14 @@ class SchemaExtender
|
|||||||
$schemaExtensions[] = $def;
|
$schemaExtensions[] = $def;
|
||||||
} elseif ($def instanceof TypeDefinitionNode) {
|
} elseif ($def instanceof TypeDefinitionNode) {
|
||||||
$typeName = isset($def->name) ? $def->name->value : null;
|
$typeName = isset($def->name) ? $def->name->value : null;
|
||||||
if ($schema->getType($typeName)) {
|
|
||||||
|
try {
|
||||||
|
$type = $schema->getType($typeName);
|
||||||
|
} catch (Error $error) {
|
||||||
|
$type = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type) {
|
||||||
throw new Error('Type "' . $typeName . '" already exists in the schema. It cannot also be defined in this type definition.', [$def]);
|
throw new Error('Type "' . $typeName . '" already exists in the schema. It cannot also be defined in this type definition.', [$def]);
|
||||||
}
|
}
|
||||||
$typeDefinitionMap[$typeName] = $def;
|
$typeDefinitionMap[$typeName] = $def;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user