mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-16 22:08:44 +02:00
N°9319 increase php min. version to 8.2 (#887)
* Update minimum PHP version to 8.2 * Fix previous wrong resolution of merge conflict
This commit is contained in:
24
lib/symfony/cache/Adapter/ArrayAdapter.php
vendored
24
lib/symfony/cache/Adapter/ArrayAdapter.php
vendored
@@ -34,6 +34,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
private array $values = [];
|
||||
private array $tags = [];
|
||||
private array $expiries = [];
|
||||
private array $explicitExpiries = [];
|
||||
private int $defaultLifetime;
|
||||
private float $maxLifetime;
|
||||
private int $maxItems;
|
||||
@@ -58,7 +59,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
$this->maxLifetime = $maxLifetime;
|
||||
$this->maxItems = $maxItems;
|
||||
self::$createCacheItem ??= \Closure::bind(
|
||||
static function ($key, $value, $isHit, $tags) {
|
||||
static function ($key, $value, $isHit, $tags, $expiry = null) {
|
||||
$item = new CacheItem();
|
||||
$item->key = $key;
|
||||
$item->value = $value;
|
||||
@@ -66,6 +67,9 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
if (null !== $tags) {
|
||||
$item->metadata[CacheItem::METADATA_TAGS] = $tags;
|
||||
}
|
||||
if (null !== $expiry) {
|
||||
$item->metadata[CacheItem::METADATA_EXPIRY] = $expiry;
|
||||
}
|
||||
|
||||
return $item;
|
||||
},
|
||||
@@ -126,7 +130,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
$value = $this->storeSerialized ? $this->unfreeze($key, $isHit) : $this->values[$key];
|
||||
}
|
||||
|
||||
return (self::$createCacheItem)($key, $value, $isHit, $this->tags[$key] ?? null);
|
||||
return (self::$createCacheItem)($key, $value, $isHit, $this->tags[$key] ?? null, $this->explicitExpiries[$key] ?? null);
|
||||
}
|
||||
|
||||
public function getItems(array $keys = []): iterable
|
||||
@@ -139,7 +143,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
public function deleteItem(mixed $key): bool
|
||||
{
|
||||
\assert('' !== CacheItem::validateKey($key));
|
||||
unset($this->values[$key], $this->tags[$key], $this->expiries[$key]);
|
||||
unset($this->values[$key], $this->tags[$key], $this->expiries[$key], $this->explicitExpiries[$key]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -193,13 +197,19 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
break;
|
||||
}
|
||||
|
||||
unset($this->values[$k], $this->tags[$k], $this->expiries[$k]);
|
||||
unset($this->values[$k], $this->tags[$k], $this->expiries[$k], $this->explicitExpiries[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->values[$key] = $value;
|
||||
$this->expiries[$key] = $expiry ?? \PHP_INT_MAX;
|
||||
|
||||
if (null !== $item["\0*\0expiry"] && \PHP_INT_MAX !== $this->expiries[$key]) {
|
||||
$this->explicitExpiries[$key] = $this->expiries[$key];
|
||||
} else {
|
||||
unset($this->explicitExpiries[$key]);
|
||||
}
|
||||
|
||||
if (null === $this->tags[$key] = $item["\0*\0newMetadata"][CacheItem::METADATA_TAGS] ?? null) {
|
||||
unset($this->tags[$key]);
|
||||
}
|
||||
@@ -224,7 +234,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
|
||||
foreach ($this->values as $key => $value) {
|
||||
if (!isset($this->expiries[$key]) || $this->expiries[$key] <= $now || str_starts_with($key, $prefix)) {
|
||||
unset($this->values[$key], $this->tags[$key], $this->expiries[$key]);
|
||||
unset($this->values[$key], $this->tags[$key], $this->expiries[$key], $this->explicitExpiries[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +243,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
}
|
||||
}
|
||||
|
||||
$this->values = $this->tags = $this->expiries = [];
|
||||
$this->values = $this->tags = $this->expiries = $this->explicitExpiries = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -290,7 +300,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
||||
}
|
||||
unset($keys[$i]);
|
||||
|
||||
yield $key => $f($key, $value, $isHit, $this->tags[$key] ?? null);
|
||||
yield $key => $f($key, $value, $isHit, $this->tags[$key] ?? null, $this->explicitExpiries[$key] ?? null);
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
|
||||
Reference in New Issue
Block a user