재 업데이트
This commit is contained in:
1 parent
a8b3befca9
commit
ddb971e41e
413 files changed
+13446
-16025
No files matched your search
Vendored
+5
-8
@@ -20,14 +20,14 @@ final class Key
|
||||
{
|
||||
private $resource;
|
||||
private $expiringTime;
|
||||
private $state = array();
|
||||
private $state = [];
|
||||
|
||||
public function __construct(string $resource)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ final class Key
|
||||
/**
|
||||
* @param float $ttl the expiration delay of locks in seconds
|
||||
*/
|
||||
public function reduceLifetime($ttl)
|
||||
public function reduceLifetime(float $ttl)
|
||||
{
|
||||
$newTime = microtime(true) + $ttl;
|
||||
|
||||
@@ -74,15 +74,12 @@ final class Key
|
||||
*
|
||||
* @return float|null Remaining lifetime in seconds. Null when the key won't expire.
|
||||
*/
|
||||
public function getRemainingLifetime()
|
||||
public function getRemainingLifetime(): ?float
|
||||
{
|
||||
return null === $this->expiringTime ? null : $this->expiringTime - microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isExpired()
|
||||
public function isExpired(): bool
|
||||
{
|
||||
return null !== $this->expiringTime && $this->expiringTime <= microtime(true);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user