Skip to content

Commit 5afabe4

Browse files
committed
minor #38404 [HttpClient] Minor fix of type and message in ExponentialBackOff (bohanyang)
This PR was merged into the 5.2-dev branch. Discussion ---------- [HttpClient] Minor fix of type and message in ExponentialBackOff | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Make the type consistent and fix an error message Commits ------- 6149a0c04b [HttpClient] Minor fix of type and message in ExponentialBackOff
2 parents e85bb48 + 3f14296 commit 5afabe4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Retry/ExponentialBackOff.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ final class ExponentialBackOff implements RetryBackOffInterface
3939
* @param float $multiplier Multiplier to apply to the delay each time a retry occurs
4040
* @param int $maxDelayMilliseconds Maximum delay to allow (0 means no maximum)
4141
*/
42-
public function __construct(int $delayMilliseconds = 1000, float $multiplier = 2, int $maxDelayMilliseconds = 0)
42+
public function __construct(int $delayMilliseconds = 1000, float $multiplier = 2.0, int $maxDelayMilliseconds = 0)
4343
{
4444
if ($delayMilliseconds < 0) {
4545
throw new InvalidArgumentException(sprintf('Delay must be greater than or equal to zero: "%s" given.', $delayMilliseconds));
4646
}
4747
$this->delayMilliseconds = $delayMilliseconds;
4848

4949
if ($multiplier < 1) {
50-
throw new InvalidArgumentException(sprintf('Multiplier must be greater than zero: "%s" given.', $multiplier));
50+
throw new InvalidArgumentException(sprintf('Multiplier must be greater than or equal to one: "%s" given.', $multiplier));
5151
}
5252
$this->multiplier = $multiplier;
5353

@@ -65,6 +65,6 @@ public function getDelay(int $retryCount, string $requestMethod, string $request
6565
return $this->maxDelayMilliseconds;
6666
}
6767

68-
return $delay;
68+
return (int) $delay;
6969
}
7070
}

0 commit comments

Comments
 (0)