Skip to content

Commit f4f3b59

Browse files
authored
Fix PHP8 return type incompatibility (#17)
1 parent 03e940d commit f4f3b59

7 files changed

+7
-7
lines changed

src/Throttle/Throttler/AbstractWindowThrottler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ abstract public function hit();
128128
/**
129129
* @inheritdoc
130130
*/
131-
abstract public function count();
131+
abstract public function count(): int;
132132
}

src/Throttle/Throttler/ElasticWindowThrottler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function clear()
9494
/**
9595
* @inheritdoc
9696
*/
97-
public function count()
97+
public function count(): int
9898
{
9999
if (!is_null($this->counter)) {
100100
return $this->counter;

src/Throttle/Throttler/FixedWindowThrottler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function hit()
5959
/**
6060
* @inheritdoc
6161
*/
62-
public function count()
62+
public function count(): int
6363
{
6464
try {
6565
if (($this->timeProvider->now() - $this->cache->get($this->getTimeCacheKey())) > $this->timeLimit) {

src/Throttle/Throttler/LeakyBucketThrottler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function clear()
131131
/**
132132
* @inheritdoc
133133
*/
134-
public function count()
134+
public function count(): int
135135
{
136136
try {
137137
$cachedTime = $this->cache->get($this->getTimeCacheKey());

src/Throttle/Throttler/MovingWindowThrottler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function hit()
5858
/**
5959
* @inheritdoc
6060
*/
61-
public function count()
61+
public function count(): int
6262
{
6363
$this->updateHitCount();
6464

src/Throttle/Throttler/RetrialQueueThrottler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function clear()
8383
/**
8484
* @inheritdoc
8585
*/
86-
public function count()
86+
public function count(): int
8787
{
8888
return $this->internalThrottler->count();
8989
}

src/Throttle/Throttler/ThrottlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function clear();
5656
*
5757
* @return int
5858
*/
59-
public function count();
59+
public function count(): int;
6060

6161
/**
6262
* Check the throttle status

0 commit comments

Comments
 (0)