Skip to content

Commit 443175e

Browse files
authored
Fix PHP 8.1 deprecations (PHPOffice#2452)
* Fix PHP 8.1 deprecations * Fix CS * Fix CS using PHP 8.0
1 parent 3a65586 commit 443175e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/PhpSpreadsheet/Collection/Memory.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PhpOffice\PhpSpreadsheet\Collection;
44

5+
use DateInterval;
56
use Psr\SimpleCache\CacheInterface;
67

78
/**
@@ -14,20 +15,33 @@ class Memory implements CacheInterface
1415
{
1516
private $cache = [];
1617

18+
/**
19+
* @return bool
20+
*/
1721
public function clear()
1822
{
1923
$this->cache = [];
2024

2125
return true;
2226
}
2327

28+
/**
29+
* @param string $key
30+
*
31+
* @return bool
32+
*/
2433
public function delete($key)
2534
{
2635
unset($this->cache[$key]);
2736

2837
return true;
2938
}
3039

40+
/**
41+
* @param iterable $keys
42+
*
43+
* @return bool
44+
*/
3145
public function deleteMultiple($keys)
3246
{
3347
foreach ($keys as $key) {
@@ -37,6 +51,12 @@ public function deleteMultiple($keys)
3751
return true;
3852
}
3953

54+
/**
55+
* @param string $key
56+
* @param mixed $default
57+
*
58+
* @return mixed
59+
*/
4060
public function get($key, $default = null)
4161
{
4262
if ($this->has($key)) {
@@ -46,6 +66,12 @@ public function get($key, $default = null)
4666
return $default;
4767
}
4868

69+
/**
70+
* @param iterable $keys
71+
* @param mixed $default
72+
*
73+
* @return iterable
74+
*/
4975
public function getMultiple($keys, $default = null)
5076
{
5177
$results = [];
@@ -56,18 +82,36 @@ public function getMultiple($keys, $default = null)
5682
return $results;
5783
}
5884

85+
/**
86+
* @param string $key
87+
*
88+
* @return bool
89+
*/
5990
public function has($key)
6091
{
6192
return array_key_exists($key, $this->cache);
6293
}
6394

95+
/**
96+
* @param string $key
97+
* @param mixed $value
98+
* @param null|DateInterval|int $ttl
99+
*
100+
* @return bool
101+
*/
64102
public function set($key, $value, $ttl = null)
65103
{
66104
$this->cache[$key] = $value;
67105

68106
return true;
69107
}
70108

109+
/**
110+
* @param iterable $values
111+
* @param null|DateInterval|int $ttl
112+
*
113+
* @return bool
114+
*/
71115
public function setMultiple($values, $ttl = null)
72116
{
73117
foreach ($values as $key => $value) {

0 commit comments

Comments
 (0)