Skip to content

Commit ccb15c9

Browse files
Remove implicit conversion from float to int losing precision
1 parent 93ea948 commit ccb15c9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Transport/AbstractTransport.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ abstract class AbstractTransport implements TransportInterface
3737

3838
private float $rate = 0.0;
3939

40-
/**
41-
* @var float|int
42-
*/
43-
private $lastSent = 0;
40+
private float $lastSent = 0.0;
4441

4542
/**
4643
* @param null|EventDispatcherInterface $dispatcher The event dispatcher
@@ -66,7 +63,7 @@ public function setMaxPerSecond(float $rate): self
6663
}
6764

6865
$this->rate = $rate;
69-
$this->lastSent = 0;
66+
$this->lastSent = 0.0;
7067

7168
return $this;
7269
}
@@ -142,7 +139,7 @@ private function checkThrottling(): void
142139

143140
if (0 < $sleep) {
144141
$this->getLogger()->debug(sprintf('SMS transport "%s" sleeps for %.2f seconds', static::class, $sleep));
145-
usleep($sleep * 1000000);
142+
usleep((int) ($sleep * 1000000));
146143
}
147144

148145
$this->lastSent = microtime(true);

0 commit comments

Comments
 (0)