Revert "Fix compatibility with PHP 8.1"

This reverts commit 99338afacbb11fbe75449966ecb8f476ec27a89d.
This commit is contained in:
slawkens 2023-02-02 16:17:33 +01:00
parent 48f74b9c7a
commit d691148c84
8 changed files with 22 additions and 22 deletions

View File

@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$configForumTablePrefix = config('forum_table_prefix'); $configForumTablePrefix = config('forum_table_prefix');
if(null !== $configForumTablePrefix && !empty(trim($configForumTablePrefix))) { if(!empty(trim($configForumTablePrefix))) {
if(!in_array($configForumTablePrefix, array('myaac_', 'z_'))) { if(!in_array($configForumTablePrefix, array('myaac_', 'z_'))) {
throw new RuntimeException('Invalid value for forum_table_prefix in config.php. Can be only: "myaac_" or "z_".'); throw new RuntimeException('Invalid value for forum_table_prefix in config.php. Can be only: "myaac_" or "z_".');
} }

View File

@ -31,7 +31,7 @@
* @property-read int $access Access level. * @property-read int $access Access level.
* @tutorial POT/Accounts.pkg * @tutorial POT/Accounts.pkg
*/ */
class OTS_Account extends OTS_Row_DAO implements Countable class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
{ {
/** /**
* Account data. * Account data.
@ -1033,7 +1033,7 @@ class OTS_Account extends OTS_Row_DAO implements Countable
* @throws PDOException On PDO operation error. * @throws PDOException On PDO operation error.
* @return int Count of players. * @return int Count of players.
*/ */
public function count(): int public function count()
{ {
return $this->getPlayersList()->count(); return $this->getPlayersList()->count();
} }

View File

@ -36,7 +36,7 @@
* @property-write int $offset Sets OFFSET clause. * @property-write int $offset Sets OFFSET clause.
* @property-write OTS_SQLFilter $filter Sets filter for list SQL query. * @property-write OTS_SQLFilter $filter Sets filter for list SQL query.
*/ */
abstract class OTS_Base_List implements IOTS_DAO, Countable abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
{ {
/** /**
* Database connection. * Database connection.
@ -203,7 +203,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Countable
* *
* @throws PDOException On PDO operation error. * @throws PDOException On PDO operation error.
*/ */
public function rewind(): void public function rewind()
{ {
$this->rows = $this->db->query( $this->getSQL() )->fetchAll(); $this->rows = $this->db->query( $this->getSQL() )->fetchAll();
} }
@ -211,7 +211,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Countable
/** /**
* Moves to next row. * Moves to next row.
*/ */
public function next(): void public function next()
{ {
next($this->rows); next($this->rows);
} }
@ -231,7 +231,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Countable
* *
* @return bool Does next row exist. * @return bool Does next row exist.
*/ */
public function valid(): bool public function valid()
{ {
return key($this->rows) !== null; return key($this->rows) !== null;
} }
@ -243,7 +243,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Countable
* @return int Number of rows. * @return int Number of rows.
* @throws PDOException On PDO operation error. * @throws PDOException On PDO operation error.
*/ */
public function count(): int public function count()
{ {
return $this->db->query( $this->getSQL(true) )->fetchColumn(); return $this->db->query( $this->getSQL(true) )->fetchColumn();
} }

View File

@ -5,7 +5,7 @@ trait OTS_DB_PDOQuery
/** /**
* @return PDOStatement * @return PDOStatement
*/ */
public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs)
{ {
return $this->doQuery($query, $fetchMode, ...$fetchModeArgs); return $this->doQuery($query, $fetchMode, ...$fetchModeArgs);
} }

View File

@ -26,7 +26,7 @@
* @property-read int $id Row ID. * @property-read int $id Row ID.
* @property-read OTS_Players_List $playersList List of members of this group. * @property-read OTS_Players_List $playersList List of members of this group.
*/ */
class OTS_Group extends OTS_Row_DAO implements Countable class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
{ {
/** /**
* Group data. * Group data.
@ -552,7 +552,7 @@ class OTS_Group extends OTS_Row_DAO implements Countable
* @throws PDOException On PDO operation error. * @throws PDOException On PDO operation error.
* @return int Count of players. * @return int Count of players.
*/ */
public function count(): int public function count()
{ {
return $this->getPlayersList()->count(); return $this->getPlayersList()->count();
} }

View File

@ -14,7 +14,7 @@
* @package POT * @package POT
* @version 0.1.3 * @version 0.1.3
*/ */
class OTS_Groups_List implements Countable class OTS_Groups_List implements IteratorAggregate, Countable
{ {
/** /**
* Groups. * Groups.
@ -210,7 +210,7 @@ class OTS_Groups_List implements Countable
* @since 0.1.5 * @since 0.1.5
* @return int Amount of all groups. * @return int Amount of all groups.
*/ */
public function count(): int public function count()
{ {
return count($this->groups); return count($this->groups);
} }

View File

@ -30,7 +30,7 @@
* @property-write IOTS_GuildAction $requestsDriver Membership requests handler. * @property-write IOTS_GuildAction $requestsDriver Membership requests handler.
* @tutorial POT/Guilds.pkg * @tutorial POT/Guilds.pkg
*/ */
class OTS_Guild extends OTS_Row_DAO implements Countable class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
{ {
/** /**
* Guild data. * Guild data.
@ -723,7 +723,7 @@ class OTS_Guild extends OTS_Row_DAO implements Countable
* @throws PDOException On PDO operation error. * @throws PDOException On PDO operation error.
* @return int Count of ranks. * @return int Count of ranks.
*/ */
public function count(): int public function count()
{ {
return $this->getGuildRanksList()->count(); return $this->getGuildRanksList()->count();
} }

View File

@ -25,7 +25,7 @@
* @property-read int $id Row ID. * @property-read int $id Row ID.
* @property-read OTS_Players_List $playersList List of members with this rank. * @property-read OTS_Players_List $playersList List of members with this rank.
*/ */
class OTS_GuildRank extends OTS_Row_DAO implements Countable class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable
{ {
/** /**
* Rank data. * Rank data.
@ -410,7 +410,7 @@ class OTS_GuildRank extends OTS_Row_DAO implements Countable
* @throws PDOException On PDO operation error. * @throws PDOException On PDO operation error.
* @return int Count of players. * @return int Count of players.
*/ */
public function count(): int public function count()
{ {
return $this->getPlayersList()->count(); return $this->getPlayersList()->count();
} }