From 79bf7b74c42d9fffb5d36ef41fcfd93b2c05245d Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Sat, 3 Feb 2024 22:34:24 -0300 Subject: [PATCH] Fix PHP 8.2+ --- system/database/Databases/Object/Result.php | 2 ++ .../Databases/Object/ResultCacheIterator.php | 1 + system/session/Redis/Handler.php | 14 ++++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/system/database/Databases/Object/Result.php b/system/database/Databases/Object/Result.php index 4f54cf4..53ecc14 100644 --- a/system/database/Databases/Object/Result.php +++ b/system/database/Databases/Object/Result.php @@ -165,6 +165,7 @@ class Result extends \ArrayIterator implements ResultInterface { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetGet($index) { if(!$this->offsetExists($index)) return null; @@ -178,6 +179,7 @@ class Result extends \ArrayIterator implements ResultInterface { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function current() { $item = new \Phacil\Framework\Databases\Object\Item(parent::current()); diff --git a/system/database/Databases/Object/ResultCacheIterator.php b/system/database/Databases/Object/ResultCacheIterator.php index d0ab0b6..b7cd9ce 100644 --- a/system/database/Databases/Object/ResultCacheIterator.php +++ b/system/database/Databases/Object/ResultCacheIterator.php @@ -171,6 +171,7 @@ class ResultCacheIterator extends \CachingIterator implements ResultInterface { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetGet($index) { $data = null; diff --git a/system/session/Redis/Handler.php b/system/session/Redis/Handler.php index 2cdd9c3..0a1f89b 100644 --- a/system/session/Redis/Handler.php +++ b/system/session/Redis/Handler.php @@ -84,9 +84,10 @@ class Handler implements \SessionHandlerInterface { * @return bool * @throws Exception */ + #[\ReturnTypeWillChange] public function open($savePath, $sessionName) { - return $this->getConnection()->open($savePath, $sessionName); + return (bool)$this->getConnection()->open($savePath, $sessionName); } /** @@ -97,6 +98,7 @@ class Handler implements \SessionHandlerInterface { * @throws ConcurrentConnectionsExceededException * @throws Exception */ + #[\ReturnTypeWillChange] public function read($sessionId) { try { @@ -115,12 +117,13 @@ class Handler implements \SessionHandlerInterface { * @return boolean * @throws Exception */ + #[\ReturnTypeWillChange] public function write($sessionId, $sessionData) { try { //$this->getConnection()->setName($this->name); $cha = $this->getConnection()->write($sessionId, $sessionData); - return $cha; + return (bool) $cha; } catch (ConcurrentConnectionsExceededException $e) { throw new Exception($e->getMessage(), 1); } @@ -134,9 +137,10 @@ class Handler implements \SessionHandlerInterface { * @return boolean * @throws Exception */ + #[\ReturnTypeWillChange] public function destroy($sessionId) { - return $this->getConnection()->destroy($sessionId); + return (bool) $this->getConnection()->destroy($sessionId); } /** @@ -145,9 +149,10 @@ class Handler implements \SessionHandlerInterface { * @return bool * @throws Exception */ + #[\ReturnTypeWillChange] public function close() { - return $this->getConnection()->close(); + return (bool)$this->getConnection()->close(); } /** @@ -158,6 +163,7 @@ class Handler implements \SessionHandlerInterface { * @throws Exception * @SuppressWarnings(PHPMD.ShortMethodName) */ + #[\ReturnTypeWillChange] public function gc($maxLifeTime) { return $this->getConnection()->gc($maxLifeTime);