Skip to content

Update UPGRADE.md

Update UPGRADE.md #347

Triggered via pull request May 24, 2024 15:50
Status Success
Total duration 1m 10s
Artifacts

mutation.yml

on: pull_request
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#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) { } /**
mutation / PHP 8.1-ubuntu-latest: src/Policy/LimitPerIp.php#L13
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ { public function fingerprint(ServerRequestInterface $request) : string { - return sha1(strtolower($request->getMethod() . $request->getUri()->getPath() . $this->getIp($request))); + return sha1(strtolower($request->getMethod() . $this->getIp($request) . $request->getUri()->getPath())); } private function getIp(ServerRequestInterface $request) : string {
mutation / PHP 8.1-ubuntu-latest: src/Storage/ApcuStorage.php#L51
Escaped Mutant for Mutator "CastFloat": --- Original +++ New @@ @@ { /** @psalm-suppress MixedAssignment */ $value = apcu_fetch($key); - return is_int($value) || is_float($value) ? (float) $value / $this->fixPrecisionRate : null; + return is_int($value) || is_float($value) ? $value / $this->fixPrecisionRate : null; } }
mutation / PHP 8.1-ubuntu-latest: src/Storage/SimpleCacheStorage.php#L33
Escaped Mutant for Mutator "CastFloat": --- Original +++ New @@ @@ { /** @psalm-suppress MixedAssignment */ $value = $this->cache->get($key); - return is_int($value) || is_float($value) ? (float) $value : null; + return is_int($value) || is_float($value) ? $value : null; } }