From 2edbd1a3e2b90430b378de32f79a7cbd3537d9de Mon Sep 17 00:00:00 2001 From: Thorsten Date: Fri, 18 Nov 2022 19:41:56 +0100 Subject: [PATCH] Reverted some changes that won't work with PHP7.3 --- src/App/Page.php | 8 ++++---- src/BaseCollection.php | 4 ++-- src/Content/Conversation.php | 5 +---- src/Content/Nav.php | 2 +- src/Core/Session/Handler/Database.php | 4 ++-- src/Database/Database.php | 2 +- src/Model/Log/ParsedLogIterator.php | 6 +++--- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/App/Page.php b/src/App/Page.php index 5f4ac0f6d..0f14d9f6e 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -130,7 +130,7 @@ class Page implements ArrayAccess * The return value will be casted to boolean if non-boolean was returned. * @since 5.0.0 */ - public function offsetExists(mixed $offset): bool + public function offsetExists($offset): bool { return isset($this->page[$offset]); } @@ -147,7 +147,7 @@ class Page implements ArrayAccess * @return mixed Can return all value types. * @since 5.0.0 */ - public function offsetGet(mixed $offset): mixed + public function offsetGet($offset) { return $this->page[$offset] ?? null; } @@ -167,7 +167,7 @@ class Page implements ArrayAccess * @return void * @since 5.0.0 */ - public function offsetSet(mixed $offset, mixed $value): void + public function offsetSet($offset, $value) { $this->page[$offset] = $value; } @@ -184,7 +184,7 @@ class Page implements ArrayAccess * @return void * @since 5.0.0 */ - public function offsetUnset(mixed $offset): void + public function offsetUnset($offset) { if (isset($this->page[$offset])) { unset($this->page[$offset]); diff --git a/src/BaseCollection.php b/src/BaseCollection.php index c71175572..f6fa9bbd4 100644 --- a/src/BaseCollection.php +++ b/src/BaseCollection.php @@ -48,7 +48,7 @@ class BaseCollection extends \ArrayIterator /** * @inheritDoc */ - public function offsetSet(mixed $offset, mixed $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->totalCount++; @@ -60,7 +60,7 @@ class BaseCollection extends \ArrayIterator /** * @inheritDoc */ - public function offsetUnset(mixed $offset): void + public function offsetUnset($offset) { if ($this->offsetExists($offset)) { $this->totalCount--; diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 46a906b13..da9aee87b 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -794,10 +794,7 @@ class Conversation return []; } - $blocked = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked'); - if (!empty($blocked)) { - $str_blocked = str_replace(["\n", "\r"], ",", $blocked); - } + $str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked')); if (empty($str_blocked)) { return []; } diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 17fb1d12c..0000b3d29 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -245,7 +245,7 @@ class Nav $gdirpath = 'directory'; - if (empty(DI::config()->get('system', 'singleuser'))) { + if (strlen(DI::config()->get('system', 'singleuser'))) { $gdir = DI::config()->get('system', 'directory'); if (strlen($gdir)) { $gdirpath = Profile::zrl($gdir, true); diff --git a/src/Core/Session/Handler/Database.php b/src/Core/Session/Handler/Database.php index 6d067d8b6..41ccb6b33 100644 --- a/src/Core/Session/Handler/Database.php +++ b/src/Core/Session/Handler/Database.php @@ -57,7 +57,7 @@ class Database extends AbstractSessionHandler return true; } - public function read($id): string|false + public function read($id) { if (empty($id)) { return ''; @@ -136,7 +136,7 @@ class Database extends AbstractSessionHandler } } - public function gc($max_lifetime): int|false + public function gc($max_lifetime): bool { try { return $this->dba->delete('session', ["`expire` < ?", time()]); diff --git a/src/Database/Database.php b/src/Database/Database.php index 5dac99bce..79c39e9af 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -117,7 +117,7 @@ class Database $port = trim($serverdata[1]); } - if (!empty(trim((string) $this->configCache->get('database', 'port')))) { + if (!empty(trim($this->configCache->get('database', 'port')))) { $port = trim($this->configCache->get('database', 'port')); } diff --git a/src/Model/Log/ParsedLogIterator.php b/src/Model/Log/ParsedLogIterator.php index 151a66adb..4309e4cd0 100644 --- a/src/Model/Log/ParsedLogIterator.php +++ b/src/Model/Log/ParsedLogIterator.php @@ -160,7 +160,7 @@ class ParsedLogIterator implements \Iterator * @see Iterator::next() * @return void */ - public function next(): void + public function next() { $parsed = $this->read(); @@ -177,7 +177,7 @@ class ParsedLogIterator implements \Iterator * @see Iterator::rewind() * @return void */ - public function rewind(): void + public function rewind() { $this->value = null; $this->reader->rewind(); @@ -202,7 +202,7 @@ class ParsedLogIterator implements \Iterator * @see Iterator::current() * @return ?ParsedLogLing */ - public function current(): mixed + public function current() { return $this->value; }