diff --git a/Storage/src/SigningHelper.php b/Storage/src/SigningHelper.php index ea4c7ca601e..e15bfca2448 100644 --- a/Storage/src/SigningHelper.php +++ b/Storage/src/SigningHelper.php @@ -185,11 +185,9 @@ public function v2Sign(ConnectionInterface $connection, $expires, $resource, $ge $stringToSign = $this->createV2CanonicalRequest($toSign); // Use exponential backOff - $signature = $this->retrySignBlob(function () use ($credentials, $stringToSign, $options) { - return $credentials->signBlob($stringToSign, [ - 'forceOpenssl' => $options['forceOpenssl'] - ]); - }); + $signature = $this->retrySignBlob(fn () => $credentials->signBlob($stringToSign, [ + 'forceOpenssl' => $options['forceOpenssl'] + ])); // Start with user-provided query params and add required parameters. $params = $options['queryParams']; @@ -343,15 +341,11 @@ public function v4Sign(ConnectionInterface $connection, $expires, $resource, $ge $requestHash ]); - $signature = bin2hex(base64_decode($this->retrySignBlob(function () use ( - $credentials, - $stringToSign, - $options - ) { - return $credentials->signBlob($stringToSign, [ + $signature = bin2hex(base64_decode($this->retrySignBlob( + fn() => $credentials->signBlob($stringToSign, [ 'forceOpenssl' => $options['forceOpenssl'] - ]); - }))); + ]) + ))); // Construct the modified resource name. If a custom hostname is provided, // this will remove the bucket name from the resource. diff --git a/Storage/tests/Unit/SigningHelperTest.php b/Storage/tests/Unit/SigningHelperTest.php index 8e25e020e4b..4aad4a6c865 100644 --- a/Storage/tests/Unit/SigningHelperTest.php +++ b/Storage/tests/Unit/SigningHelperTest.php @@ -819,6 +819,7 @@ public function testRetrySignBlobSuccessAfterRetries() ]); $this->assertEquals('signature', $res); + $this->assertEquals(3, $attempt); } public function testRetrySignBlobNonRetryableError() @@ -833,8 +834,6 @@ public function testRetrySignBlobNonRetryableError() $res = $this->helper->proxyPrivateMethodCall('retrySignBlob', [ $signBlobFn ]); - - $this->assertEquals('Non-retryable error', $res); } }