Skip to content

Commit 9a759de

Browse files
committed
Forced return type hint to Psr16Adapter && added a getter for the internal cache instance
1 parent 38cfdc3 commit 9a759de

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

lib/Phpfastcache/Helper/Psr16Adapter.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function get($key, $default = null)
8080
* @return bool
8181
* @throws \Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException
8282
*/
83-
public function set($key, $value, $ttl = null)
83+
public function set($key, $value, $ttl = null): bool
8484
{
8585
try {
8686
$cacheItem = $this->internalCacheInstance
@@ -102,7 +102,7 @@ public function set($key, $value, $ttl = null)
102102
* @return bool
103103
* @throws \Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException
104104
*/
105-
public function delete($key)
105+
public function delete($key): bool
106106
{
107107
try {
108108
return $this->internalCacheInstance->deleteItem($key);
@@ -115,7 +115,7 @@ public function delete($key)
115115
* @return bool
116116
* @throws \Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException
117117
*/
118-
public function clear()
118+
public function clear(): bool
119119
{
120120
try {
121121
return $this->internalCacheInstance->clear();
@@ -147,7 +147,7 @@ public function getMultiple($keys, $default = null)
147147
* @return bool
148148
* @throws \Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException
149149
*/
150-
public function setMultiple($values, $ttl = null)
150+
public function setMultiple($values, $ttl = null): bool
151151
{
152152
try {
153153
foreach ($values as $key => $value) {
@@ -172,7 +172,7 @@ public function setMultiple($values, $ttl = null)
172172
* @return bool
173173
* @throws \Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException
174174
*/
175-
public function deleteMultiple($keys)
175+
public function deleteMultiple($keys): bool
176176
{
177177
try {
178178
return $this->internalCacheInstance->deleteItems($keys);
@@ -186,7 +186,7 @@ public function deleteMultiple($keys)
186186
* @return bool
187187
* @throws \Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException
188188
*/
189-
public function has($key)
189+
public function has($key): bool
190190
{
191191
try {
192192
$cacheItem = $this->internalCacheInstance->getItem($key);
@@ -195,4 +195,17 @@ public function has($key)
195195
throw new PhpfastcacheSimpleCacheException($e->getMessage(), null, $e);
196196
}
197197
}
198+
199+
/**
200+
* Extra methods that are not part of
201+
* psr16 specifications
202+
*/
203+
204+
/**
205+
* @return \Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface
206+
*/
207+
public function getInternalCacheInstance(): ExtendedCacheItemPoolInterface
208+
{
209+
return $this->internalCacheInstance;
210+
}
198211
}

0 commit comments

Comments
 (0)