Skip to content

Commit 488e1da

Browse files
committed
feat(Storage): enforce strict return types on headObject
Adds : array return type hint to ConnectionInterface and Rest connection client implementations, and fixes GCS retry conformance test TypeError crash by correctly returning GCS response headers array.
1 parent 1764aba commit 488e1da

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Storage/src/Connection/ConnectionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function getObject(array $args = []);
134134
* @param array $args
135135
* @return array
136136
*/
137-
public function headObject(array $args = []);
137+
public function headObject(array $args = []): array;
138138

139139
/**
140140
* @param array $args

Storage/src/Connection/Rest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public function getObject(array $args = [])
310310
* @param array $args
311311
* @return array
312312
*/
313-
public function headObject(array $args = [])
313+
public function headObject(array $args = []): array
314314
{
315315
$args += [
316316
'prettyPrint' => false,
@@ -345,7 +345,8 @@ public function headObject(array $args = [])
345345
$request = $this->requestBuilder->build('objects', 'get', $args);
346346
$request = $request->withMethod('HEAD');
347347

348-
return $this->requestWrapper->send($request, $requestOptions);
348+
$response = $this->requestWrapper->send($request, $requestOptions);
349+
return $response->getHeaders();
349350
}
350351

351352
/**

0 commit comments

Comments
 (0)