From ed2d16e6c102cb712eb8d3e9a8e0006cc146c6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Wed, 30 Nov 2022 12:26:39 +0100 Subject: [PATCH] IBX-2469: Fixed Serializable deprecation warning on PHP 8.1 (#45) * IBX-2469: Fixed Serializable deprecation warning on PHP 8.1 * Converted list to short syntax & added missing type hints --- lib/Templating/TemplatePathRegistry.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/Templating/TemplatePathRegistry.php b/lib/Templating/TemplatePathRegistry.php index 32c01be..cf2dd09 100644 --- a/lib/Templating/TemplatePathRegistry.php +++ b/lib/Templating/TemplatePathRegistry.php @@ -10,11 +10,10 @@ class TemplatePathRegistry implements TemplatePathRegistryInterface, Serializable { + /** @var array */ private $pathMap = []; - /** - * @var - */ + /** @var string */ private $kernelRootDir; public function __construct($kernelRootDir) @@ -44,6 +43,16 @@ public function serialize() public function unserialize($serialized) { - list($this->pathMap, $this->kernelRootDir) = unserialize($serialized); + [$this->pathMap, $this->kernelRootDir] = unserialize($serialized); + } + + public function __serialize(): array + { + return [$this->pathMap, $this->kernelRootDir]; + } + + public function __unserialize(array $data): void + { + [$this->pathMap, $this->kernelRootDir] = $data; } }