Skip to content

Commit 3f14296

Browse files
author
Bohan Yang
committed
[HttpClient] Minor fix of type and message in ExponentialBackOff
1 parent 8d80cf8 commit 3f14296

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)