Fix PHP 8.1 deprecations (#2452)
* Fix PHP 8.1 deprecations * Fix CS * Fix CS using PHP 8.0
This commit is contained in:
parent
3a6558625d
commit
443175e25c
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheet\Collection;
|
||||
|
||||
use DateInterval;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -14,6 +15,9 @@ class Memory implements CacheInterface
|
|||
{
|
||||
private $cache = [];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->cache = [];
|
||||
|
|
@ -21,6 +25,11 @@ class Memory implements CacheInterface
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
unset($this->cache[$key]);
|
||||
|
|
@ -28,6 +37,11 @@ class Memory implements CacheInterface
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param iterable $keys
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
|
|
@ -37,6 +51,12 @@ class Memory implements CacheInterface
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
|
|
@ -46,6 +66,12 @@ class Memory implements CacheInterface
|
|||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param iterable $keys
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return iterable
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
{
|
||||
$results = [];
|
||||
|
|
@ -56,11 +82,23 @@ class Memory implements CacheInterface
|
|||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return array_key_exists($key, $this->cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param null|DateInterval|int $ttl
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
{
|
||||
$this->cache[$key] = $value;
|
||||
|
|
@ -68,6 +106,12 @@ class Memory implements CacheInterface
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param iterable $values
|
||||
* @param null|DateInterval|int $ttl
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue