Skip to content

Commit 2e64b17

Browse files
committed
Implemented JsonSerializable interface to ExtendedCacheItemInterface
1 parent 4a75f02 commit 2e64b17

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/phpFastCache/Cache/ExtendedCacheItemInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Interface ExtendedCacheItemInterface
2121
* @package phpFastCache\Cache
2222
*/
23-
interface ExtendedCacheItemInterface extends CacheItemInterface
23+
interface ExtendedCacheItemInterface extends CacheItemInterface, \JsonSerializable
2424
{
2525
/**
2626
* @return mixed

src/phpFastCache/Cache/ItemBaseTrait.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,13 @@ public function getDataAsJsonString($option = 0, $depth = 512)
418418
}
419419

420420
/**
421-
* @throws \RuntimeException
422-
*/
423-
/* final public function __sleep()
424-
{
425-
$info = get_object_vars($this);
426-
$info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
427-
428-
return (array) $info;
429-
}*/
421+
* Implements \JsonSerializable interface
422+
* @return mixed
423+
*/
424+
public function jsonSerialize()
425+
{
426+
return $this->get();
427+
}
430428

431429
/**
432430
* Prevent recursions for Debug (php 5.6+)

0 commit comments

Comments
 (0)