Skip to content

Commit

Permalink
fix incorrect locations schema in error
Browse files Browse the repository at this point in the history
  • Loading branch information
joonlabs committed Jun 30, 2022
1 parent f1d696a commit a6db03d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Errors/GraphQLError.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Errors/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testConvertNodeToPosition()
]
];
$Error = new GraphQLError("message", $node);
self::assertSame($Error->getLocations(), $node["loc"]);
self::assertSame($Error->getLocations(), [$node["loc"]]);
}


Expand Down

0 comments on commit a6db03d

Please sign in to comment.