for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BenTools\GuzzleHttp\Middleware\Storage;
class Counter implements \Serializable, \JsonSerializable, \Countable
{
/**
* @var float
*/
private $expiresIn;
private $expiresAt;
* @var int
private $counter;
* Counter constructor.
* @param float $startTime
$startTime
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param int $nbRequests
$nbRequests
public function __construct(float $expiresIn)
$this->expiresIn = $expiresIn;
$this->reset();
}
private function reset()
$this->counter = 0;
$this->expiresAt = microtime(true) + $this->expiresIn;
* Increment counter.
public function increment()
if ($this->isExpired()) {
} else {
$this->counter++;
* @return int
public function count(): int
return $this->counter;
* @return float
public function getRemainingTime()
return (float) max(0, $this->expiresAt - microtime(true));
* @return bool
public function isExpired()
return 0.0 === $this->getRemainingTime();
* @inheritDoc
public function serialize()
return json_encode($this);
public function unserialize($serialized)
$data = json_decode($serialized, true);
$this->expiresAt = $data['e'];
$this->expiresIn = $data['i'];
$this->counter = $data['n'];
public function jsonSerialize()
return [
'i' => $this->expiresIn,
'e' => $this->expiresAt,
'n' => $this->counter,
];
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.