diff --git a/src/Errors/GraphQLError.php b/src/Errors/GraphQLError.php index 85c25b3..4a2ee26 100644 --- a/src/Errors/GraphQLError.php +++ b/src/Errors/GraphQLError.php @@ -38,7 +38,7 @@ public function __construct(string $message = "", array $node = null, array $pat */ public function getLocations(): ?array { - return $this->node["loc"] ?? null; + return [$this->node["loc"]] ?? null; } /** diff --git a/tests/Errors/ErrorTest.php b/tests/Errors/ErrorTest.php index 11a892a..f52b71c 100644 --- a/tests/Errors/ErrorTest.php +++ b/tests/Errors/ErrorTest.php @@ -19,7 +19,7 @@ public function testConvertNodeToPosition() ] ]; $Error = new GraphQLError("message", $node); - self::assertSame($Error->getLocations(), $node["loc"]); + self::assertSame($Error->getLocations(), [$node["loc"]]); }