Skip to content

Commit a6db03d

Browse files
committed
fix incorrect locations schema in error
1 parent f1d696a commit a6db03d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Errors/GraphQLError.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(string $message = "", array $node = null, array $pat
3838
*/
3939
public function getLocations(): ?array
4040
{
41-
return $this->node["loc"] ?? null;
41+
return [$this->node["loc"]] ?? null;
4242
}
4343

4444
/**

tests/Errors/ErrorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testConvertNodeToPosition()
1919
]
2020
];
2121
$Error = new GraphQLError("message", $node);
22-
self::assertSame($Error->getLocations(), $node["loc"]);
22+
self::assertSame($Error->getLocations(), [$node["loc"]]);
2323
}
2424

2525

0 commit comments

Comments
 (0)