mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
PHP 8.1 compatibility
This commit is contained in:
parent
9de8145f82
commit
8c801dddec
@ -11,7 +11,7 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$configForumTablePrefix = config('forum_table_prefix');
|
||||
if(!empty(trim($configForumTablePrefix))) {
|
||||
if(null !== $configForumTablePrefix && !empty(trim($configForumTablePrefix))) {
|
||||
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_".');
|
||||
}
|
||||
|
@ -1091,6 +1091,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return Iterator List of players.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->getPlayersList();
|
||||
@ -1105,7 +1106,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return int Count of players.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->getPlayersList()->count();
|
||||
}
|
||||
|
@ -190,6 +190,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
|
||||
* @version 0.1.3
|
||||
* @return OTS_Base_DAO Current row.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
$id = current($this->rows);
|
||||
@ -203,7 +204,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
|
||||
*
|
||||
* @throws PDOException On PDO operation error.
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->rows = $this->db->query( $this->getSQL() )->fetchAll();
|
||||
}
|
||||
@ -211,7 +212,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
|
||||
/**
|
||||
* Moves to next row.
|
||||
*/
|
||||
public function next()
|
||||
public function next(): void
|
||||
{
|
||||
next($this->rows);
|
||||
}
|
||||
@ -221,6 +222,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
|
||||
*
|
||||
* @return mixed Array key.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return key($this->rows);
|
||||
@ -231,7 +233,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
|
||||
*
|
||||
* @return bool Does next row exist.
|
||||
*/
|
||||
public function valid()
|
||||
public function valid(): bool
|
||||
{
|
||||
return key($this->rows) !== null;
|
||||
}
|
||||
@ -243,7 +245,7 @@ abstract class OTS_Base_List implements IOTS_DAO, Iterator, Countable
|
||||
* @return int Number of rows.
|
||||
* @throws PDOException On PDO operation error.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->db->query( $this->getSQL(true) )->fetchColumn();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class OTS_Container extends OTS_Item implements IteratorAggregate
|
||||
*
|
||||
* @return int Number of items.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($items);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ if (PHP_VERSION_ID >= 80000) {
|
||||
/**
|
||||
* @return PDOStatement
|
||||
*/
|
||||
public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs)
|
||||
public function query(?string $query = null, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement
|
||||
{
|
||||
return $this->doQuery($query, $fetchMode, ...$fetchModeArgs);
|
||||
}
|
||||
|
@ -538,6 +538,7 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return Iterator List of players.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->getPlayersList();
|
||||
@ -552,7 +553,7 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return int Count of players.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->getPlayersList()->count();
|
||||
}
|
||||
|
@ -196,6 +196,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
||||
* @since 0.1.5
|
||||
* @return AppendIterator Iterator for all groups.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
$iterator = new AppendIterator();
|
||||
@ -210,7 +211,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
||||
* @since 0.1.5
|
||||
* @return int Amount of all groups.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->groups);
|
||||
}
|
||||
|
@ -709,6 +709,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return Iterator List of ranks.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->getGuildRanksList();
|
||||
@ -723,7 +724,7 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return int Count of ranks.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->getGuildRanksList()->count();
|
||||
}
|
||||
|
@ -396,6 +396,7 @@ class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return Iterator List of players.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->getPlayersList();
|
||||
@ -410,7 +411,7 @@ class OTS_GuildRank extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @throws PDOException On PDO operation error.
|
||||
* @return int Count of players.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->getPlayersList()->count();
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess
|
||||
*
|
||||
* @return int Count of houses.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->houses);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class OTS_Item implements Countable
|
||||
*
|
||||
* @return int Count of item.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab
|
||||
*
|
||||
* @return int Count of types.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->items);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
|
||||
*
|
||||
* @return int Count of monsters.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->monsters);
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl
|
||||
* @since 0.0.8
|
||||
* @return int Count of towns.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->towns);
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ class OTS_SpellsList implements IteratorAggregate, Countable
|
||||
* @since 0.1.5
|
||||
* @return int Amount of all spells.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->runes) + count($this->instants) + count($this->conjures);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess
|
||||
*
|
||||
* @return int Count of vocations.
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->vocations);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user