Skip to content

Commit d8416e6

Browse files
author
Plokko
committed
Fix support for php-fig/cache
1 parent 08ef193 commit d8416e6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/ServiceAccountCacheItemPool.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function __construct(array $config=null)
5151
* @return CacheItemInterface
5252
* The corresponding Cache Item.
5353
*/
54-
public function getItem($key)
54+
public function getItem(string $key): CacheItemInterface
5555
{
5656
return $this->cache->get(self::CACHE_PREFIX.$key)?:new Item($key);
5757
}
@@ -72,7 +72,7 @@ public function getItem($key)
7272
* key is not found. However, if no keys are specified then an empty
7373
* traversable MUST be returned instead.
7474
*/
75-
public function getItems(array $keys = array())
75+
public function getItems(array $keys = array()): iterable
7676
{
7777
$items = [];
7878
foreach($keys AS $k){
@@ -98,7 +98,7 @@ public function getItems(array $keys = array())
9898
* @return bool
9999
* True if item exists in the cache, false otherwise.
100100
*/
101-
public function hasItem($key)
101+
public function hasItem($key): bool
102102
{
103103
return $this->cache->has(self::CACHE_PREFIX.$key);
104104
}
@@ -109,7 +109,7 @@ public function hasItem($key)
109109
* @return bool
110110
* True if the pool was successfully cleared. False if there was an error.
111111
*/
112-
public function clear()
112+
public function clear(): bool
113113
{
114114
$this->cache->flush();
115115
return true;
@@ -128,7 +128,7 @@ public function clear()
128128
* @return bool
129129
* True if the item was successfully removed. False if there was an error.
130130
*/
131-
public function deleteItem($key)
131+
public function deleteItem($key): bool
132132
{
133133
return $this->cache->delete(self::CACHE_PREFIX.$key);
134134
}
@@ -144,7 +144,7 @@ public function deleteItem($key)
144144
* @return bool
145145
* True if the items were successfully removed. False if there was an error.
146146
*/
147-
public function deleteItems(array $keys)
147+
public function deleteItems(array $keys): bool
148148
{
149149
foreach($keys AS $key){
150150
$this->deleteItem($key);
@@ -161,7 +161,7 @@ public function deleteItems(array $keys)
161161
* @return bool
162162
* True if the item was successfully persisted. False if there was an error.
163163
*/
164-
public function save(CacheItemInterface $item)
164+
public function save(CacheItemInterface $item): bool
165165
{
166166
try {
167167
$this->cache->set(self::CACHE_PREFIX.$item->getKey(), $item,$this->ttl);
@@ -180,7 +180,7 @@ public function save(CacheItemInterface $item)
180180
* @return bool
181181
* False if the item could not be queued or if a commit was attempted and failed. True otherwise.
182182
*/
183-
public function saveDeferred(CacheItemInterface $item)
183+
public function saveDeferred(CacheItemInterface $item): bool
184184
{
185185
$this->deferred[] = $item;
186186
return true;
@@ -192,12 +192,12 @@ public function saveDeferred(CacheItemInterface $item)
192192
* @return bool
193193
* True if all not-yet-saved items were successfully saved or there were none. False otherwise.
194194
*/
195-
public function commit()
195+
public function commit(): bool
196196
{
197197
foreach($this->deferred AS $item){
198198
if(!$this->save($item))
199199
return false;
200200
}
201201
return true;
202202
}
203-
}
203+
}

0 commit comments

Comments
 (0)