Some code tweaks and fixes
All checks were successful
Gitea - aviat/banker/pipeline/head This commit looks good
All checks were successful
Gitea - aviat/banker/pipeline/head This commit looks good
This commit is contained in:
parent
49399b80ef
commit
db431e6b2a
@ -28,7 +28,7 @@
|
||||
"require": {
|
||||
"php": ">= 8",
|
||||
"ext-json": "*",
|
||||
"predis/predis": "^1.1",
|
||||
"predis/predis": "^1.1.10",
|
||||
"psr/log": "*",
|
||||
"psr/cache": "^3.0.0",
|
||||
"psr/simple-cache": "^3.0.0"
|
||||
@ -36,15 +36,15 @@
|
||||
"require-dev": {
|
||||
"ext-apcu": "*",
|
||||
"ext-memcached": "*",
|
||||
"consolidation/robo": "^3.0.6",
|
||||
"monolog/monolog": "^2.3.5",
|
||||
"pdepend/pdepend": "^2.2",
|
||||
"phploc/phploc": "^7.0",
|
||||
"phpmd/phpmd": "^2.4",
|
||||
"phpunit/phpunit": "^9.5.0",
|
||||
"consolidation/robo": "^3.0.11",
|
||||
"monolog/monolog": "^2.8.0",
|
||||
"pdepend/pdepend": "^2.12.1",
|
||||
"phploc/phploc": "^7.0.2",
|
||||
"phpmd/phpmd": "^2.13",
|
||||
"phpunit/phpunit": "^9.6.0",
|
||||
"sebastian/phpcpd": "^6.0.3",
|
||||
"squizlabs/php_codesniffer": "^3.3.2",
|
||||
"phpstan/phpstan": "^1.2.0"
|
||||
"squizlabs/php_codesniffer": "^3.7.1",
|
||||
"phpstan/phpstan": "^1.9.14"
|
||||
},
|
||||
"suggest": {
|
||||
"monolog/monolog": "A good standard logging library",
|
||||
|
@ -28,7 +28,7 @@ use MemcachedException;
|
||||
class MemcachedDriver extends AbstractDriver {
|
||||
|
||||
/**
|
||||
* @var Memcached
|
||||
* The Memcached connection
|
||||
*/
|
||||
private Memcached $conn;
|
||||
|
||||
@ -184,7 +184,6 @@ class MemcachedDriver extends AbstractDriver {
|
||||
|
||||
$deleted = $this->conn->deleteMulti($keys);
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
if (is_array($deleted))
|
||||
{
|
||||
foreach ($deleted as $key => $status)
|
||||
@ -197,8 +196,6 @@ class MemcachedDriver extends AbstractDriver {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ class Item implements CacheItemInterface {
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $value;
|
||||
protected mixed $value = null;
|
||||
|
||||
/**
|
||||
* Create a Cache Item object
|
||||
@ -157,7 +157,7 @@ class Item implements CacheItemInterface {
|
||||
* @return static
|
||||
* The called object.
|
||||
*/
|
||||
public function expiresAt($expiration = NULL): static
|
||||
public function expiresAt(DateTimeInterface $expiration = NULL): static
|
||||
{
|
||||
if ($expiration instanceof DateTimeInterface)
|
||||
{
|
||||
@ -172,7 +172,7 @@ class Item implements CacheItemInterface {
|
||||
/**
|
||||
* Sets the expiration time for this cache item.
|
||||
*
|
||||
* @param int|DateInterval|null $time
|
||||
* @param DateInterval|int|null $time
|
||||
* The period of time from the present after which the item MUST be considered
|
||||
* expired. An integer parameter is understood to be the time in seconds until
|
||||
* expiration. If null is passed explicitly, a default value MAY be used.
|
||||
@ -182,7 +182,7 @@ class Item implements CacheItemInterface {
|
||||
* @return static
|
||||
* The called object.
|
||||
*/
|
||||
public function expiresAfter($time = NULL): static
|
||||
public function expiresAfter(DateInterval|int $time = NULL): static
|
||||
{
|
||||
if ($time instanceof DateInterval)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ class ItemCollection extends ArrayIterator implements JsonSerializable {
|
||||
* @param array $items - array of CacheItemInterface objects
|
||||
* @param int $flags - flags
|
||||
*/
|
||||
public function __construct(array $items = [], $flags = 0)
|
||||
public function __construct(array $items = [], int $flags = 0)
|
||||
{
|
||||
parent::__construct($items, $flags);
|
||||
$this->items = $items;
|
||||
|
@ -32,8 +32,6 @@ trait LoggerTrait {
|
||||
/**
|
||||
* Return the existing logger instance or
|
||||
* a NullLogger, if no instance set
|
||||
*
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
protected function getLogger(): LoggerInterface
|
||||
{
|
||||
@ -46,9 +44,6 @@ trait LoggerTrait {
|
||||
|
||||
/**
|
||||
* Set a logger to keep track of errors
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
* @return self
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger): self
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ trait _Driver {
|
||||
protected function loadDriver(array $driverConfig = []): AbstractDriver
|
||||
{
|
||||
$driver = ucfirst(strtolower($driverConfig['driver'] ?? 'null'));
|
||||
$class = __NAMESPACE__ . "\\Driver\\${driver}Driver";
|
||||
$class = __NAMESPACE__ . "\\Driver\\{$driver}Driver";
|
||||
|
||||
$driverConfig['connection'] = $driverConfig['connection'] ?? [];
|
||||
$driverConfig['options'] = $driverConfig['options'] ?? [];
|
||||
|
@ -60,10 +60,11 @@ class ItemTest extends TestCase {
|
||||
$friend = new Friend($this->item);
|
||||
$this->assertEquals($expected, $friend->expiresAt, "DateTimeInterface");
|
||||
|
||||
$time2 = strtotime("July 16, 2024");
|
||||
$time2stamp = strtotime("July 16, 2024");
|
||||
$time2 = new DateTime("July 16, 2024");
|
||||
$this->item->expiresAt($time2);
|
||||
$friend2 = new Friend($this->item);
|
||||
$this->assertEquals($time2, $friend2->expiresAt, "Unix Timestamp");
|
||||
$this->assertEquals($time2stamp, $friend2->expiresAt, "Unix Timestamp");
|
||||
}
|
||||
|
||||
public function testExpiresAfter(): void
|
||||
|
Loading…
Reference in New Issue
Block a user