8000 bug #48501 [RateLimiter] Add `int` to `Reservation::wait()` (DaRealFr… · symfony/symfony@e807503 · GitHub
[go: up one dir, main page]

Skip to content

Commit e807503

Browse files
bug #48501 [RateLimiter] Add int to Reservation::wait() (DaRealFreak)
This PR was submitted for the 6.3 branch but it was merged into the 5.4 branch instead. Discussion ---------- [RateLimiter] Add `int` to `Reservation::wait()` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no 8000 | Tickets | Fix #48500 | License | MIT The `usleep` function accepts int as parameter type (https://www.php.net/manual/en/function.usleep.php), while the passed type is float in `Reservation::wait` (due to `Reservation::getWaitDuration` returning a float value for the 1e6 multiplication) To prevent deprecation notices we can typecast the float value to int before passing it to `usleep` Commits ------- 6ad3279 [RateLimiter] Add typecast to Reservation::wait
2 parents 75f8547 + 6ad3279 commit e807503

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/RateLimiter/Reservation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ public function getRateLimit(): RateLimit
4545

4646
public function wait(): void
4747
{
48-
usleep($this->getWaitDuration() * 1e6);
48+
usleep((int) ($this->getWaitDuration() * 1e6));
4949
}
5050
}

0 commit comments

Comments
 (0)
0