Skip to content

Commit c029296

Browse files
oojacobooJulien Neuhart
andauthored
guilien-patch-1 branch with improved exception messages (#496)
* Update CannotMapTypeException.php * Update IteratorTypeMapperTest.php * Update CannotMapTypeException.php * Update FieldsBuilderTest.php * Lock in doctrine/annotations version as newest version breaks Co-authored-by: Julien Neuhart <j.neuhart@thecodingmachine.com>
1 parent 647b54f commit c029296

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"require": {
1313
"php": ">=7.4",
1414
"ext-json": "*",
15-
"doctrine/annotations": "^1.13",
15+
"doctrine/annotations": "1.13.2",
1616
"composer/package-versions-deprecated": "^1.8",
1717
"phpdocumentor/reflection-docblock": "^4.3 || ^5.0",
1818
"phpdocumentor/type-resolver": "^1.4",

src/Mappers/CannotMapTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function createForType(string $className): self
4242
*/
4343
public static function createForInputType(string $className): self
4444
{
45-
return new self('cannot map class "' . $className . '" to a known GraphQL input type. Check your TypeMapper configuration.');
45+
return new self('cannot map class "' . $className . '" to a known GraphQL input type. Are you missing a @Factory annotation? If you have a @Factory annotation, is it in a namespace analyzed by GraphQLite?');
4646
}
4747

4848
public static function createForName(string $name): self

tests/FieldsBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public function testQueryProviderWithInvalidInputType(): void
508508
$queryProvider = $this->buildFieldsBuilder();
509509

510510
$this->expectException(CannotMapTypeException::class);
511-
$this->expectExceptionMessage('For parameter $foo, in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithInvalidInputType::test, cannot map class "Exception" to a known GraphQL input type. Check your TypeMapper configuration.');
511+
$this->expectExceptionMessage('For parameter $foo, in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithInvalidInputType::test, cannot map class "Exception" to a known GraphQL input type. Are you missing a @Factory annotation? If you have a @Factory annotation, is it in a namespace analyzed by GraphQLite?');
512512
$queryProvider->getQueries($controller);
513513
}
514514

tests/Mappers/Root/IteratorTypeMapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testInputIterator(): void
1919

2020
// A type like ArrayObject|int[] CAN be mapped to an output type, but NOT to an input type.
2121
$this->expectException(CannotMapTypeException::class);
22-
$this->expectExceptionMessage('cannot map class "ArrayObject" to a known GraphQL input type. Check your TypeMapper configuration.');
22+
$this->expectExceptionMessage('cannot map class "ArrayObject" to a known GraphQL input type. Are you missing a @Factory annotation? If you have a @Factory annotation, is it in a namespace analyzed by GraphQLite?');
2323
$typeMapper->toGraphQLInputType($this->resolveType('ArrayObject|int[]'), null, 'foo', new ReflectionMethod(__CLASS__, 'testInputIterator'), new DocBlock());
2424
}
2525

0 commit comments

Comments
 (0)