mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
105
lib/symfony/cache/Adapter/TraceableAdapter.php
vendored
105
lib/symfony/cache/Adapter/TraceableAdapter.php
vendored
@@ -28,17 +28,14 @@ use Symfony\Contracts\Service\ResetInterface;
|
||||
class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface
|
||||
{
|
||||
protected $pool;
|
||||
private $calls = [];
|
||||
private array $calls = [];
|
||||
|
||||
public function __construct(AdapterInterface $pool)
|
||||
{
|
||||
$this->pool = $pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
|
||||
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
|
||||
{
|
||||
if (!$this->pool instanceof CacheInterface) {
|
||||
throw new \BadMethodCallException(sprintf('Cannot call "%s::get()": this class doesn\'t implement "%s".', get_debug_type($this->pool), CacheInterface::class));
|
||||
@@ -67,10 +64,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getItem($key)
|
||||
public function getItem(mixed $key): CacheItem
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -87,12 +81,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasItem($key)
|
||||
public function hasItem(mixed $key): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -102,12 +91,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteItem($key)
|
||||
public function deleteItem(mixed $key): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -117,12 +101,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function save(CacheItemInterface $item)
|
||||
public function save(CacheItemInterface $item): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -132,12 +111,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function saveDeferred(CacheItemInterface $item)
|
||||
public function saveDeferred(CacheItemInterface $item): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -147,10 +121,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getItems(array $keys = [])
|
||||
public function getItems(array $keys = []): iterable
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -173,12 +144,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
return $f();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clear(string $prefix = '')
|
||||
public function clear(string $prefix = ''): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -192,12 +158,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteItems(array $keys)
|
||||
public function deleteItems(array $keys): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
$event->result['keys'] = $keys;
|
||||
@@ -208,12 +169,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function commit()
|
||||
public function commit(): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
try {
|
||||
@@ -223,10 +179,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prune()
|
||||
public function prune(): bool
|
||||
{
|
||||
if (!$this->pool instanceof PruneableInterface) {
|
||||
return false;
|
||||
@@ -240,7 +193,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
@@ -251,9 +204,6 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
$this->clearCalls();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(string $key): bool
|
||||
{
|
||||
$event = $this->start(__FUNCTION__);
|
||||
@@ -264,16 +214,30 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCalls()
|
||||
{
|
||||
return $this->calls;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clearCalls()
|
||||
{
|
||||
$this->calls = [];
|
||||
}
|
||||
|
||||
public function getPool(): AdapterInterface
|
||||
{
|
||||
return $this->pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TraceableAdapterEvent
|
||||
*/
|
||||
protected function start(string $name)
|
||||
{
|
||||
$this->calls[] = $event = new TraceableAdapterEvent();
|
||||
@@ -284,12 +248,15 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class TraceableAdapterEvent
|
||||
{
|
||||
public $name;
|
||||
public $start;
|
||||
public $end;
|
||||
public $result;
|
||||
public $hits = 0;
|
||||
public $misses = 0;
|
||||
public string $name;
|
||||
public float $start;
|
||||
public float $end;
|
||||
public array|bool $result;
|
||||
public int $hits = 0;
|
||||
public int $misses = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user