mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 04:46:04 +03:00
BUGFIX: expect ->getType() to throw
(cherry picked from commit 62b0036437
)
This commit is contained in:
parent
59c128c54a
commit
22cee49747
@ -513,7 +513,14 @@ class SchemaExtender
|
||||
$schemaExtensions[] = $def;
|
||||
} elseif ($def instanceof TypeDefinitionNode) {
|
||||
$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]);
|
||||
}
|
||||
$typeDefinitionMap[$typeName] = $def;
|
||||
|
Loading…
Reference in New Issue
Block a user