diff --git a/php-require-checker.config.json b/php-require-checker.config.json index 0982c19..fb346ac 100644 --- a/php-require-checker.config.json +++ b/php-require-checker.config.json @@ -1,6 +1,6 @@ { "symbol-whitelist": [ - "int", "array", "null", "parent", "string", "void", + "int", "array", "null", "parent", "string", "void", "bool", "false", "Redis", "Memcached" ] } diff --git a/src/PhpFileAdapter.php b/src/PhpFileAdapter.php new file mode 100644 index 0000000..dae5388 --- /dev/null +++ b/src/PhpFileAdapter.php @@ -0,0 +1,41 @@ + */ + private $args; + + public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, bool $appendOnly = false) + { + $this->args = func_get_args(); + parent::__construct($namespace, $defaultLifetime, $directory, $appendOnly); + } + + /** + * @inheritDoc + */ + public function serialize() + { + return serialize($this->args); + } + + /** + * @inheritDoc + */ + public function unserialize($data) + { + call_user_func_array([$this, '__construct'], unserialize($data)); + } +} diff --git a/tests/PhpFileAdapterTest.php b/tests/PhpFileAdapterTest.php new file mode 100644 index 0000000..b3d6760 --- /dev/null +++ b/tests/PhpFileAdapterTest.php @@ -0,0 +1,29 @@ +assertIsString($string); + + return $string; + } + + /** + * @depends testSerialize + */ + public function testUnserialize(string $string): void + { + $this->assertInstanceOf(PhpFileAdapter::class, unserialize($string)); + } +}