mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-29 00:25:17 +03:00
BUGFIX: expect ->getType() to throw
This commit is contained in:
parent
e22b400373
commit
62b0036437
@ -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…
Reference in New Issue
Block a user