Skip to content

Commit e4f9516

Browse files
chore: rename namespace and apply style fixes
- Move opening brace to next line on new method signatures. - Rename src/Retry/Standard -> src/Retry/V3 and tests/Retry/Standard -> tests/Retry/V3 - Update namespaces in moved files - Rename alias StandardRetryMiddleware -> RetryV3Middleware at all import and call sites - OptInTest: move ' true' / 'true ' from nonMatchingValues to a new matchingValues provider (with extra whitespace variants) so tests match the trim($value) === 'true' contract in OptIn::isEnabled
1 parent fba3cb6 commit e4f9516

16 files changed

Lines changed: 80 additions & 45 deletions

src/ClientResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
use Aws\Exception\InvalidRegionException;
3232
use Aws\Retry\ConfigurationInterface as RetryConfigInterface;
3333
use Aws\Retry\ConfigurationProvider as RetryConfigProvider;
34-
use Aws\Retry\Standard\OptIn as NewRetriesOptIn;
35-
use Aws\Retry\Standard\RetryMiddleware as StandardRetryMiddleware;
34+
use Aws\Retry\V3\OptIn as NewRetriesOptIn;
35+
use Aws\Retry\V3\RetryMiddleware as RetryV3Middleware;
3636
use Aws\Signature\SignatureProvider;
3737
use Aws\Token\Token;
3838
use Aws\Token\TokenInterface;
@@ -569,7 +569,7 @@ public static function _apply_retries($value, array &$args, HandlerList $list)
569569

570570
if (NewRetriesOptIn::isEnabled()) {
571571
$list->appendSign(
572-
StandardRetryMiddleware::wrap($config, [
572+
RetryV3Middleware::wrap($config, [
573573
'collect_stats' => $args['stats']['retries'],
574574
'service' => $args['service'],
575575
]),

src/DynamoDb/DynamoDbClient.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use Aws\Retry\Configuration as RetryConfiguration;
1111
use Aws\Retry\ConfigurationInterface as RetryConfigurationInterface;
1212
use Aws\Retry\ConfigurationProvider as RetryConfigurationProvider;
13-
use Aws\Retry\Standard\OptIn as NewRetriesOptIn;
14-
use Aws\Retry\Standard\RetryMiddleware as StandardRetryMiddleware;
13+
use Aws\Retry\V3\OptIn as NewRetriesOptIn;
14+
use Aws\Retry\V3\RetryMiddleware as RetryV3Middleware;
1515
use Aws\RetryMiddleware;
1616
use Aws\RetryMiddlewareV2;
1717
use GuzzleHttp\Promise\Create;
@@ -223,7 +223,8 @@ private static function appendLegacyModeRetries(
223223
RetryConfigurationInterface $config,
224224
array &$args,
225225
HandlerList $list
226-
): void {
226+
): void
227+
{
227228
$maxRetries = self::resolveLegacyModeMaxRetries($value, $config);
228229

229230
$list->appendSign(
@@ -246,7 +247,8 @@ function ($retries) {
246247
private static function resolveLegacyModeMaxRetries(
247248
$value,
248249
RetryConfigurationInterface $config
249-
): int {
250+
): int
251+
{
250252
if (
251253
NewRetriesOptIn::isEnabled()
252254
&& is_array($value)
@@ -262,7 +264,8 @@ private static function appendStandardModeRetries(
262264
RetryConfigurationInterface $config,
263265
array &$args,
264266
HandlerList $list
265-
): void {
267+
): void
268+
{
266269
$list->appendSign(
267270
RetryMiddlewareV2::wrap(
268271
$config,
@@ -279,9 +282,10 @@ private static function appendStandardModeRetriesNew(
279282
RetryConfigurationInterface $config,
280283
array &$args,
281284
HandlerList $list
282-
): void {
285+
): void
286+
{
283287
$list->appendSign(
284-
StandardRetryMiddleware::wrap(
288+
RetryV3Middleware::wrap(
285289
$config,
286290
[
287291
'collect_stats' => $args['stats']['retries'],

src/Retry/ConfigurationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Aws\CacheInterface;
66
use Aws\ConfigurationProviderInterface;
77
use Aws\Retry\Exception\ConfigurationException;
8-
use Aws\Retry\Standard\OptIn;
8+
use Aws\Retry\V3\OptIn;
99
use GuzzleHttp\Promise;
1010
use GuzzleHttp\Promise\PromiseInterface;
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Aws\Retry\Standard;
2+
namespace Aws\Retry\V3;
33

44
/**
55
* Operations that use server-side long polling and should not be retried
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Aws\Retry\Standard;
2+
namespace Aws\Retry\V3;
33

44
/**
55
* Source of truth for the AWS_NEW_RETRIES_2026 opt-in flag. The env var
@@ -17,7 +17,12 @@ final class OptIn
1717
public static function isEnabled(): bool
1818
{
1919
if (self::$enabled === null) {
20-
self::$enabled = getenv(self::ENV) === 'true';
20+
$value = getenv(self::ENV);
21+
if (is_string($value) && trim($value) === 'true') {
22+
self::$enabled = true;
23+
} else {
24+
self::$enabled = false;
25+
}
2126
}
2227

2328
return self::$enabled;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Aws\Retry\Standard;
2+
namespace Aws\Retry\V3;
33

44
/**
55
* Retry-quota manager for the AWS_NEW_RETRIES_2026 opt-in path. Implements
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Aws\Retry\Standard;
2+
namespace Aws\Retry\V3;
33

44
use Aws\CommandInterface;
55
use Aws\Exception\AwsException;
@@ -337,7 +337,8 @@ private static function isRetryable(
337337
mixed $result,
338338
array $retryCurlErrors,
339339
array $options = []
340-
): bool {
340+
): bool
341+
{
341342
$errorCodes = self::$standardThrottlingErrors + self::$standardTransientErrors;
342343
if (!empty($options['transient_error_codes'])
343344
&& is_array($options['transient_error_codes'])

src/S3/S3Client.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use Aws\ResultInterface;
1919
use Aws\Retry\ConfigurationInterface as RetryConfigurationInterface;
2020
use Aws\Retry\QuotaManager;
21-
use Aws\Retry\Standard\OptIn as NewRetriesOptIn;
22-
use Aws\Retry\Standard\RetryMiddleware as StandardRetryMiddleware;
21+
use Aws\Retry\V3\OptIn as NewRetriesOptIn;
22+
use Aws\Retry\V3\RetryMiddleware as RetryV3Middleware;
2323
use Aws\RetryMiddleware;
2424
use Aws\RetryMiddlewareV2;
2525
use Aws\S3\Parser\GetBucketLocationResultMutator;
@@ -1047,7 +1047,8 @@ public static function _applyRetryConfig($value, $args, HandlerList $list)
10471047
private static function appendLegacyModeRetries(
10481048
RetryConfigurationInterface $config,
10491049
HandlerList $list
1050-
): void {
1050+
): void
1051+
{
10511052
$maxRetries = $config->getMaxAttempts() - 1;
10521053
$baseDecider = RetryMiddleware::createDefaultDecider($maxRetries);
10531054

@@ -1075,7 +1076,8 @@ private static function appendStandardModeRetries(
10751076
RetryConfigurationInterface $config,
10761077
$args,
10771078
HandlerList $list
1078-
): void {
1079+
): void
1080+
{
10791081
// decider that combines V2's default decider with S3-specific checks.
10801082
$defaultDecider = RetryMiddlewareV2::createDefaultDecider(
10811083
new QuotaManager(),
@@ -1112,12 +1114,13 @@ private static function appendStandardModeRetriesNew(
11121114
RetryConfigurationInterface $config,
11131115
$args,
11141116
HandlerList $list
1115-
): void {
1117+
): void
1118+
{
11161119
// AWS_NEW_RETRIES_2026 path. The base middleware already handles
11171120
// the standard retryable shapes, so this decider only adds the
11181121
// S3-specific socket carve-out.
11191122
$list->appendSign(
1120-
StandardRetryMiddleware::wrap(
1123+
RetryV3Middleware::wrap(
11211124
$config,
11221125
[
11231126
'collect_stats' => $args['stats']['retries'],

src/Sts/StsClient.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use Aws\Result;
1111
use Aws\Retry\ConfigurationInterface as RetryConfigurationInterface;
1212
use Aws\Retry\ConfigurationProvider as RetryConfigurationProvider;
13-
use Aws\Retry\Standard\OptIn as NewRetriesOptIn;
14-
use Aws\Retry\Standard\RetryMiddleware as StandardRetryMiddleware;
13+
use Aws\Retry\V3\OptIn as NewRetriesOptIn;
14+
use Aws\Retry\V3\RetryMiddleware as RetryV3Middleware;
1515
use Aws\RetryMiddleware;
1616
use Aws\Sts\RegionalEndpoints\ConfigurationProvider;
1717

@@ -95,7 +95,8 @@ public static function _applyRetryConfig(
9595
$value,
9696
array &$args,
9797
HandlerList $list
98-
): void {
98+
): void
99+
{
99100
if (!$value) {
100101
return;
101102
}
@@ -112,7 +113,7 @@ public static function _applyRetryConfig(
112113
}
113114

114115
$list->appendSign(
115-
StandardRetryMiddleware::wrap(
116+
RetryV3Middleware::wrap(
116117
$config,
117118
[
118119
'collect_stats' => $args['stats']['retries'],

src/data/s3/2006-03-01/endpoint-bdd-1.json.php

Lines changed: 3 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)