Skip to content
Triggered via push July 25, 2023 14:28
Status Success
Total duration 1m 31s
Artifacts
This run and associated checks have been archived and are scheduled for deletion. Learn more about checks retention

mutation.yml

on: push
Matrix: mutation / roave-infection
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L74
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ public function hit(string $id) : CounterState { $attempts = 0; - $isFailStoreUpdatedData = false; + $isFailStoreUpdatedData = true; do { // Last increment time. // In GCRA it's known as arrival time.
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L78
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ do { // Last increment time. // In GCRA it's known as arrival time. - $lastIncrementTimeInMilliseconds = round((float) $this->timer->now()->format('U.u') * 1000); + $lastIncrementTimeInMilliseconds = round((float) $this->timer->now()->format('U.u') * 1001); $lastStoredTheoreticalNextIncrementTime = $this->getLastStoredTheoreticalNextIncrementTime($id); $theoreticalNextIncrementTime = $this->calculateTheoreticalNextIncrementTime($lastIncrementTimeInMilliseconds, $lastStoredTheoreticalNextIncrementTime); $remaining = $this->calculateRemaining($lastIncrementTimeInMilliseconds, $theoreticalNextIncrementTime);
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L78
Escaped Mutant for Mutator "RoundingFamily": --- Original +++ New @@ @@ do { // Last increment time. // In GCRA it's known as arrival time. - $lastIncrementTimeInMilliseconds = round((float) $this->timer->now()->format('U.u') * 1000); + $lastIncrementTimeInMilliseconds = floor((float) $this->timer->now()->format('U.u') * 1000); $lastStoredTheoreticalNextIncrementTime = $this->getLastStoredTheoreticalNextIncrementTime($id); $theoreticalNextIncrementTime = $this->calculateTheoreticalNextIncrementTime($lastIncrementTimeInMilliseconds, $lastStoredTheoreticalNextIncrementTime); $remaining = $this->calculateRemaining($lastIncrementTimeInMilliseconds, $theoreticalNextIncrementTime);
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L78
Escaped Mutant for Mutator "RoundingFamily": --- Original +++ New @@ @@ do { // Last increment time. // In GCRA it's known as arrival time. - $lastIncrementTimeInMilliseconds = round((float) $this->timer->now()->format('U.u') * 1000); + $lastIncrementTimeInMilliseconds = ceil((float) $this->timer->now()->format('U.u') * 1000); $lastStoredTheoreticalNextIncrementTime = $this->getLastStoredTheoreticalNextIncrementTime($id); $theoreticalNextIncrementTime = $this->calculateTheoreticalNextIncrementTime($lastIncrementTimeInMilliseconds, $lastStoredTheoreticalNextIncrementTime); $remaining = $this->calculateRemaining($lastIncrementTimeInMilliseconds, $theoreticalNextIncrementTime);
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L106
Escaped Mutant for Mutator "Break_": --- Original +++ New @@ @@ $attempts++; if ($attempts >= $this->maxCasAttempts) { $isFailStoreUpdatedData = true; - break; + continue; } } while (true); return new CounterState($this->limit, $remaining, $resetAfter, $isFailStoreUpdatedData);
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L137
Escaped Mutant for Mutator "RoundingFamily": --- Original +++ New @@ @@ private function calculateRemaining(float $lastIncrementTimeInMilliseconds, float $theoreticalNextIncrementTime) : int { $incrementAllowedAt = $theoreticalNextIncrementTime - $this->periodInMilliseconds; - $remainingTimeInMilliseconds = round($lastIncrementTimeInMilliseconds - $incrementAllowedAt); + $remainingTimeInMilliseconds = floor($lastIncrementTimeInMilliseconds - $incrementAllowedAt); if ($remainingTimeInMilliseconds > 0) { return (int) ($remainingTimeInMilliseconds / $this->incrementIntervalInMilliseconds); }
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L137
Escaped Mutant for Mutator "RoundingFamily": --- Original +++ New @@ @@ private function calculateRemaining(float $lastIncrementTimeInMilliseconds, float $theoreticalNextIncrementTime) : int { $incrementAllowedAt = $theoreticalNextIncrementTime - $this->periodInMilliseconds; - $remainingTimeInMilliseconds = round($lastIncrementTimeInMilliseconds - $incrementAllowedAt); + $remainingTimeInMilliseconds = ceil($lastIncrementTimeInMilliseconds - $incrementAllowedAt); if ($remainingTimeInMilliseconds > 0) { return (int) ($remainingTimeInMilliseconds / $this->incrementIntervalInMilliseconds); }
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L138
Escaped Mutant for Mutator "GreaterThan": --- Original +++ New @@ @@ { $incrementAllowedAt = $theoreticalNextIncrementTime - $this->periodInMilliseconds; $remainingTimeInMilliseconds = round($lastIncrementTimeInMilliseconds - $incrementAllowedAt); - if ($remainingTimeInMilliseconds > 0) { + if ($remainingTimeInMilliseconds >= 0) { return (int) ($remainingTimeInMilliseconds / $this->incrementIntervalInMilliseconds); } return 0;
mutation / PHP 8.1-ubuntu-latest: src/Counter.php#L176
Escaped Mutant for Mutator "Division": --- Original +++ New @@ @@ */ private function calculateResetAfter(float $theoreticalNextIncrementTime) : int { - return (int) ($theoreticalNextIncrementTime / self::MILLISECONDS_PER_SECOND); + return (int) ($theoreticalNextIncrementTime * self::MILLISECONDS_PER_SECOND); } /** * @return string Storage key used to store the next increment time.
mutation / PHP 8.1-ubuntu-latest: src/CounterState.php#L22
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ * @param int $resetTime Timestamp to wait until the rate limit resets. * @param bool $isFailStoreUpdatedData If fail to store updated the rate limit data. */ - public function __construct(private int $limit, private int $remaining, private int $resetTime, private bool $isFailStoreUpdatedData = false) + public function __construct(private int $limit, private int $remaining, private int $resetTime, private bool $isFailStoreUpdatedData = true) { } /**