Skip to content

Commit 90602b3

Browse files
committed
Added link to docs for generic error about unique type instance (#149)
1 parent 7f346d5 commit 90602b3

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

src/Executor/Executor.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,9 @@ private function completeValue(
945945
$hint = "Make sure that type loader returns the same instance as defined in {$info->parentType}.{$info->fieldName}";
946946
}
947947
throw new InvariantViolation(
948-
"Schema must contain unique named types but contains multiple types named \"$returnType\". $hint"
948+
"Schema must contain unique named types but contains multiple types named \"$returnType\". ".
949+
"$hint ".
950+
"(see http://webonyx.github.io/graphql-php/type-system/#type-registry)."
949951
);
950952
}
951953

@@ -1136,7 +1138,8 @@ private function ensureValidRuntimeType(
11361138
throw new InvariantViolation(
11371139
"Schema must contain unique named types but contains multiple types named \"$runtimeType\". ".
11381140
"Make sure that `resolveType` function of abstract type \"{$returnType}\" returns the same ".
1139-
"type instance as referenced anywhere else within the schema."
1141+
"type instance as referenced anywhere else within the schema " .
1142+
"(see http://webonyx.github.io/graphql-php/type-system/#type-registry)."
11401143
);
11411144
}
11421145

src/Utils/TypeInfo.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public static function extractTypes($type, array $typeMap = null)
106106
if (!empty($typeMap[$type->name])) {
107107
Utils::invariant(
108108
$typeMap[$type->name] === $type,
109-
"Schema must contain unique named types but contains multiple types named \"$type\"."
109+
"Schema must contain unique named types but contains multiple types named \"$type\" ".
110+
"(see http://webonyx.github.io/graphql-php/type-system/#type-registry)."
110111
);
111112
return $typeMap;
112113
}

tests/Executor/AbstractTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ public function testHintsOnConflictingTypeInstancesInResolveType()
483483
$this->assertEquals(
484484
'Schema must contain unique named types but contains multiple types named "Test". '.
485485
'Make sure that `resolveType` function of abstract type "Node" returns the same type instance '.
486-
'as referenced anywhere else within the schema.',
486+
'as referenced anywhere else within the schema '.
487+
'(see http://webonyx.github.io/graphql-php/type-system/#type-registry).',
487488
$result->errors[0]->getMessage()
488489
);
489490
}

tests/Executor/ExecutorLazySchemaTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ public function testHintsOnConflictingTypeInstancesInDefinitions()
185185

186186
$this->assertEquals(
187187
'Schema must contain unique named types but contains multiple types named "Test". '.
188-
'Make sure that type loader returns the same instance as defined in Query.test',
188+
'Make sure that type loader returns the same instance as defined in Query.test '.
189+
'(see http://webonyx.github.io/graphql-php/type-system/#type-registry).',
189190
$result->errors[0]->getMessage()
190191
);
191192
$this->assertInstanceOf(

tests/Type/ValidationTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ public function testRejectsASchemaWhichRedefinesABuiltInType()
359359

360360
$this->setExpectedException(
361361
InvariantViolation::class,
362-
'Schema must contain unique named types but contains multiple types named "String".'
362+
'Schema must contain unique named types but contains multiple types named "String" '.
363+
'(see http://webonyx.github.io/graphql-php/type-system/#type-registry).'
363364
);
364365
new Schema(['query' => $QueryType]);
365366
}
@@ -389,7 +390,8 @@ public function testRejectsASchemaWhichDfinesAnObjectTypeTwice()
389390

390391
$this->setExpectedException(
391392
InvariantViolation::class,
392-
'Schema must contain unique named types but contains multiple types named "SameName".'
393+
'Schema must contain unique named types but contains multiple types named "SameName" '.
394+
'(see http://webonyx.github.io/graphql-php/type-system/#type-registry).'
393395
);
394396

395397
new Schema([ 'query' => $QueryType ]);
@@ -427,7 +429,8 @@ public function testRejectsASchemaWhichHaveSameNamedObjectsImplementingAnInterfa
427429

428430
$this->setExpectedException(
429431
InvariantViolation::class,
430-
'Schema must contain unique named types but contains multiple types named "BadObject".'
432+
'Schema must contain unique named types but contains multiple types named "BadObject" '.
433+
'(see http://webonyx.github.io/graphql-php/type-system/#type-registry).'
431434
);
432435

433436
new Schema([

0 commit comments

Comments
 (0)