Skip to content

Commit

Permalink
Fix #297
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Feb 17, 2025
1 parent 14181fa commit ed311c2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/OpenSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ public function request(
string $method,
string $uri,
array $attributes = []
): array|string|null {
): \Traversable|array|string|null {
$params = $attributes['params'] ?? [];
$body = $attributes['body'] ?? null;
$options = $attributes['options'] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch/HttpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function sendRequest(
array $params = [],
mixed $body = null,
array $headers = [],
): array|string|null {
): \Traversable|array|string|null {
$request = $this->createRequest($method, $uri, $params, $body, $headers);
$response = $this->client->sendRequest($request);
$statusCode = $response->getStatusCode();
Expand Down
11 changes: 4 additions & 7 deletions src/OpenSearch/LegacyTransportWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ public function sendRequest(
array $params = [],
mixed $body = null,
array $headers = [],
): array|string|null {
$promise = $this->transport->performRequest($method, $uri, $params, $body);
$futureArray = $this->transport->resultOrFuture($promise);
if ($futureArray instanceof FutureArrayInterface) {
return $futureArray->wait();
}
return $futureArray;
): \Traversable|array|string|null {
$promise = $this->transport->performRequest($method, $uri, $params, $body, $headers);

return $this->transport->resultOrFuture($promise, $headers);
}

}
2 changes: 1 addition & 1 deletion src/OpenSearch/TransportInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function sendRequest(
array $params = [],
string|array|null $body = null,
array $headers = [],
): array|string|null;
): \Traversable|array|string|null;

}

0 comments on commit ed311c2

Please sign in to comment.