diff --git a/system/libs/forum.php b/system/libs/forum.php index 648a9d99..4922a9c3 100644 --- a/system/libs/forum.php +++ b/system/libs/forum.php @@ -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_".'); } @@ -322,4 +322,4 @@ class Forum return $hasAccess; } } -?> \ No newline at end of file +?> diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 8a9e63ac..89db0d16 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -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(); } diff --git a/system/libs/pot/OTS_Base_List.php b/system/libs/pot/OTS_Base_List.php index c3df55df..4581fdf2 100644 --- a/system/libs/pot/OTS_Base_List.php +++ b/system/libs/pot/OTS_Base_List.php @@ -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(); } diff --git a/system/libs/pot/OTS_Container.php b/system/libs/pot/OTS_Container.php index 71340d7c..7b93570f 100644 --- a/system/libs/pot/OTS_Container.php +++ b/system/libs/pot/OTS_Container.php @@ -15,11 +15,11 @@ /** * Container item representation. - * + * *

* This class represents items that can contain other items. It's {@link OTS_Container::count() count() method} has been overwritten so it now doesn't return count of current item (if it would even be possible for containers) but amount of items within (not recursively). *

- * + * * @package POT * @version 0.1.3 */ @@ -27,14 +27,14 @@ class OTS_Container extends OTS_Item implements IteratorAggregate { /** * Contained items. - * + * * @var array */ private $items = array(); /** * Adds item to container. - * + * * @param OTS_Item $item Item. */ public function addItem(OTS_Item $item) @@ -44,11 +44,11 @@ class OTS_Container extends OTS_Item implements IteratorAggregate /** * Removes given item from current container. - * + * *

* Passed item must be exacly instance of item which is stored in container, not it's copy. This method bases on PHP references. *

- * + * * @param OTS_Item $item Item. * @tutorial POT/Players.pkg#deleting */ @@ -66,14 +66,14 @@ class OTS_Container extends OTS_Item implements IteratorAggregate /** * Number of items inside container. - * + * *

* OTS_Container implementation of Countable interface differs from {@link OTS_Item OTS_Item} implemention. {@link OTS_Item::count() OTS_Item::count()} returns count of given item, OTS_Container::count() returns number of items inside container. If somehow it would be possible to make container items with more then 1 in one place, you can use {@link OTS_Item::getCount() OTS_Item::getCount()} and {@link OTS_Item::setCount() OTS_Item::setCount()} in code where you are not sure if working with regular item, or container. *

- * + * * @return int Number of items. */ - public function count() + public function count(): int { return count($items); } @@ -123,7 +123,7 @@ class OTS_Container extends OTS_Item implements IteratorAggregate /** * Returns iterator handle for loops. - * + * * @version 0.1.0 * @since 0.1.0 * @return ArrayIterator Items iterator. @@ -135,7 +135,7 @@ class OTS_Container extends OTS_Item implements IteratorAggregate /** * Clones all contained items. - * + * * @version 0.1.3 * @since 0.1.3 */ diff --git a/system/libs/pot/OTS_DB_PDOQuery.php b/system/libs/pot/OTS_DB_PDOQuery.php index 24ebfa3a..15939173 100644 --- a/system/libs/pot/OTS_DB_PDOQuery.php +++ b/system/libs/pot/OTS_DB_PDOQuery.php @@ -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); } diff --git a/system/libs/pot/OTS_Group.php b/system/libs/pot/OTS_Group.php index 819d8b50..19f770f1 100644 --- a/system/libs/pot/OTS_Group.php +++ b/system/libs/pot/OTS_Group.php @@ -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(); } diff --git a/system/libs/pot/OTS_Groups_List.php b/system/libs/pot/OTS_Groups_List.php index 083615de..868180dd 100644 --- a/system/libs/pot/OTS_Groups_List.php +++ b/system/libs/pot/OTS_Groups_List.php @@ -41,7 +41,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable $info['access'] = $group['name']; $this->groups[$group['id']] = new OTS_Group($info); } - + return; } @@ -50,7 +50,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable global $config; $file = $config['data_path'] . 'XML/groups.xml'; } - + if(!@file_exists($file)) { error('Error: Cannot load groups.xml. More info in system/logs/error.log file.'); log_append('error.log', '[OTS_Groups_List.php] Fatal error: Cannot load groups.xml (' . $file . '). It doesnt exist.'); @@ -99,7 +99,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable log_append('error.log', '[OTS_Groups_List.php] Fatal error: Cannot load groups.xml (' . $file . '). Error: ' . print_r(error_get_last(), true)); return; } - + // loads groups foreach($groups->getElementsByTagName('group') as $group) { @@ -157,7 +157,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable if($id > $group_id) $group_id = $id; } - + return $group_id; } @@ -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); } diff --git a/system/libs/pot/OTS_Guild.php b/system/libs/pot/OTS_Guild.php index 27e3e102..98dd47cf 100644 --- a/system/libs/pot/OTS_Guild.php +++ b/system/libs/pot/OTS_Guild.php @@ -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(); } diff --git a/system/libs/pot/OTS_GuildRank.php b/system/libs/pot/OTS_GuildRank.php index 24e1478c..a8832faa 100644 --- a/system/libs/pot/OTS_GuildRank.php +++ b/system/libs/pot/OTS_GuildRank.php @@ -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(); } diff --git a/system/libs/pot/OTS_HousesList.php b/system/libs/pot/OTS_HousesList.php index eda74f45..722e049f 100644 --- a/system/libs/pot/OTS_HousesList.php +++ b/system/libs/pot/OTS_HousesList.php @@ -15,7 +15,7 @@ /** * Wrapper for houses list. - * + * * @package POT * @version 0.1.3 * @tutorial POT/data_directory.pkg#towns.houses @@ -24,14 +24,14 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess { /** * List of houses elements. - * + * * @var array */ private $houses = array(); /** * Loads houses information. - * + * * @version 0.1.3 * @param string $path Houses file. * @throws DOMException On DOM operation error. @@ -49,11 +49,11 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Magic PHP5 method. - * + * *

* Allows object importing from {@link http://www.php.net/manual/en/function.var-export.php var_export()}. *

- * + * * @param array $properties List of object properties. * @throws DOMException On DOM operation error. */ @@ -72,7 +72,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Checks if given house exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param string $name Name. @@ -94,7 +94,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Returns house information. - * + * * @version 0.1.3 * @param int $id House ID. * @return OTS_House House information wrapper. @@ -112,7 +112,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Checks if given house ID exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param int $id ID. @@ -125,7 +125,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Returns ID of house with given name. - * + * * @version 0.1.3 * @param string $name House name. * @return int House ID. @@ -147,17 +147,17 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Returns amount of houses. - * + * * @return int Count of houses. */ - public function count() + public function count(): int { return count($this->houses); } /** * Returns iterator handle for loops. - * + * * @return ArrayIterator Houses list iterator. */ public function getIterator() @@ -167,7 +167,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Checks if given element exists. - * + * * @param string|int $offset Array key. * @return bool True if it's set. */ @@ -185,7 +185,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Returns item from given position. - * + * * @version 0.1.3 * @param string|int $offset Array key. * @return OTS_House|int If key is an integer (type-sensitive!) then returns house instance. If it's a string then return associated ID found by house name. @@ -204,7 +204,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to houses list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @param string|int $offset Array key. * @param mixed $value Field value. * @throws E_OTS_ReadOnly Always - this class is read-only. @@ -216,7 +216,7 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to houses list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @param string|int $offset Array key. * @throws E_OTS_ReadOnly Always - this class is read-only. */ @@ -227,11 +227,11 @@ class OTS_HousesList implements IteratorAggregate, Countable, ArrayAccess /** * Returns string representation of object. - * + * *

* If any display driver is currently loaded then it uses it's method. *

- * + * * @version 0.1.3 * @since 0.1.3 * @return string String representation of object. diff --git a/system/libs/pot/OTS_Item.php b/system/libs/pot/OTS_Item.php index cbcb2fa9..449bf73c 100644 --- a/system/libs/pot/OTS_Item.php +++ b/system/libs/pot/OTS_Item.php @@ -15,11 +15,11 @@ /** * Single item representation. - * + * *

* This class represents item that player has. It has no information about item feature, just it's handle in database. To get information about item type and it's features you have to use {@link OTS_ItemType OTS_ItemType class} - you can get it's object by calling {@link OTS_Item::getItemType() getItemType() method}, however you need to have global item types list loaded. *

- * + * * @package POT * @version 0.1.0 * @property int $count Amount of item. @@ -31,28 +31,28 @@ class OTS_Item implements Countable { /** * Item ID. - * + * * @var int */ private $id; /** * Item count. - * + * * @var int */ private $count = 0; /** * Additional attributes. - * + * * @var string */ private $attributes; /** * Creates item of given ID. - * + * * @param int $id Item ID. */ public function __construct($id) @@ -62,7 +62,7 @@ class OTS_Item implements Countable /** * Returns item type. - * + * * @return int Item ID. */ public function getId() @@ -72,7 +72,7 @@ class OTS_Item implements Countable /** * Returns count of item. - * + * * @return int Count of item. */ public function getCount() @@ -82,7 +82,7 @@ class OTS_Item implements Countable /** * Sets count of item. - * + * * @param int $count Count. */ public function setCount($count) @@ -92,7 +92,7 @@ class OTS_Item implements Countable /** * Returns item custom attributes. - * + * * @return string Attributes. */ public function getAttributes() @@ -102,7 +102,7 @@ class OTS_Item implements Countable /** * Sets item attributes. - * + * * @param string $attributes Item Attributes. */ public function setAttributes($attributes) @@ -112,7 +112,7 @@ class OTS_Item implements Countable /** * Returns type of item. - * + * * @version 0.1.0 * @since 0.1.0 * @return OTS_ItemType Returns item type of item (null if not exists). @@ -125,17 +125,17 @@ class OTS_Item implements Countable /** * Count value for current item. - * + * * @return int Count of item. */ - public function count() + public function count(): int { return $this->count; } /** * Magic PHP5 method. - * + * * @version 0.1.0 * @since 0.1.0 * @param string $name Property name. @@ -166,7 +166,7 @@ class OTS_Item implements Countable /** * Magic PHP5 method. - * + * * @version 0.1.0 * @since 0.1.0 * @param string $name Property name. diff --git a/system/libs/pot/OTS_ItemsList.php b/system/libs/pot/OTS_ItemsList.php index a9dcb2dd..1865117a 100644 --- a/system/libs/pot/OTS_ItemsList.php +++ b/system/libs/pot/OTS_ItemsList.php @@ -7,7 +7,7 @@ /** * Code in this file bases on oryginal OTServ items loading C++ code (itemloader.h, items.cpp, items.h). - * + * * @package POT * @version 0.1.3 * @author Wrzasq @@ -17,7 +17,7 @@ /** * Items list loader. - * + * * @package POT * @version 0.1.3 * @property-read int $otbVersion OTB file version. @@ -88,35 +88,35 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Temple positions. - * + * * @var array */ private $items = array(); /** * OTB version. - * + * * @var int */ private $otbVersion; /** * Client version. - * + * * @var int */ private $clientVersion; /** * Build version. - * + * * @var int */ private $buildVersion; /** * Magic PHP5 method. - * + * *

* Allows object unserialisation. *

@@ -129,11 +129,11 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Loads items.xml and items.otb files. - * + * *

* This method loads both items.xml and items.otb files. Both of them has to be in given directory. *

- * + * * @version 0.1.3 * @param string $path Path to data/items directory. * @throws E_OTS_FileLoaderError When error occurs during file operation. @@ -191,7 +191,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Parses loaded file. - * + * * @version 0.1.0 * @throws E_OTS_FileLoaderError If file has invalid format. */ @@ -378,7 +378,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns OTB file version. - * + * * @return int OTB format version. */ public function getOTBVersion() @@ -388,7 +388,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns client version. - * + * * @return int Client version. */ public function getClientVersion() @@ -398,7 +398,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns build version. - * + * * @return int Build version. */ public function getBuildVersion() @@ -408,7 +408,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Checks if given item type exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param string $name Name. @@ -430,7 +430,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns given item type. - * + * * @version 0.1.3 * @param int $id Item type (server) ID. * @return OTS_ItemType Returns item type of given ID. @@ -448,7 +448,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Checks if given type ID exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param int $id ID. @@ -461,11 +461,11 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Finds item type by it's name. - * + * *

* Note: If there are more then one items with same name this function will return first found server ID. It doesn't also mean that it will be the lowest ID - item types are ordered in order that they were loaded from items.xml file. *

- * + * * @version 0.1.3 * @param string $name Item type name. * @return int Returns item type (server) ID. @@ -497,10 +497,10 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns amount of items loaded. - * + * * @return int Count of types. */ - public function count() + public function count(): int { return count($this->items); } @@ -550,7 +550,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns iterator handle for loops. - * + * * @version 0.1.0 * @since 0.1.0 * @return ArrayIterator Items list iterator. @@ -562,7 +562,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Checks if given element exists. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -582,7 +582,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns item from given position. - * + * * @version 0.1.3 * @since 0.1.0 * @param string|int $offset Array key. @@ -602,7 +602,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to items list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -616,7 +616,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to items list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -629,7 +629,7 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Magic PHP5 method. - * + * * @version 0.1.0 * @since 0.1.0 * @param string $name Property name. @@ -652,11 +652,11 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab /** * Returns string representation of object. - * + * *

* If any display driver is currently loaded then it uses it's method. *

- * + * * @version 0.1.3 * @since 0.1.3 * @return string String representation of object. diff --git a/system/libs/pot/OTS_MonstersList.php b/system/libs/pot/OTS_MonstersList.php index 22ef6df7..bdc6bd06 100644 --- a/system/libs/pot/OTS_MonstersList.php +++ b/system/libs/pot/OTS_MonstersList.php @@ -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); } diff --git a/system/libs/pot/OTS_OTBMFile.php b/system/libs/pot/OTS_OTBMFile.php index 3469f858..3183247f 100644 --- a/system/libs/pot/OTS_OTBMFile.php +++ b/system/libs/pot/OTS_OTBMFile.php @@ -7,7 +7,7 @@ /** * Code in this file bases on oryginal OTServ OTBM format loading C++ code (iomapotbm.h, iomapotbm.cpp). - * + * * @package POT * @version 0.1.3 * @author Wrzasq @@ -20,11 +20,11 @@ /** * OTBM format reader. - * + * *

* POT OTBM file parser is less strict then oryginal OTServ one. For instance it will read waypoints from version 1 OTBM file even that there were no waypoints in that format. *

- * + * * @package POT * @version 0.1.6 * @property-read OTS_HousesList $housesList Houses list loaded from associated houses file. @@ -95,56 +95,56 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl const OTBM_ATTR_HOUSEDOORID = 14; /** * Amount. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_COUNT = 15; /** * Time interval. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_DURATION = 16; /** * Metamorphic stage. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_DECAYING_STATE = 17; /** * Date of being written. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_WRITTENDATE = 18; /** * Sign author. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_WRITTENBY = 19; /** * Sleeping player ID. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_SLEEPERGUID = 20; /** * Time of sleep started. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_ATTR_SLEEPSTART = 21; /** * Number of charges. - * + * * @version 0.1.6 * @since 0.1.6 */ @@ -208,14 +208,14 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl const OTBM_NODE_HOUSETILE = 14; /** * Waypoints list. - * + * * @version 0.1.6 * @since 0.1.6 */ const OTBM_NODE_WAYPOINTS = 15; /** * Waypoint. - * + * * @version 0.1.6 * @since 0.1.6 */ @@ -223,56 +223,56 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Map width. - * + * * @var int */ private $width; /** * Map height. - * + * * @var int */ private $height; /** * Map description. - * + * * @var string */ private $description = ''; /** * List of towns. - * + * * @var array */ private $towns = array(); /** * Temple positions. - * + * * @var array */ private $temples = array(); /** * Directory path. - * + * * @var string */ private $directory; /** * External houses file. - * + * * @var OTS_HousesList */ private $housesList; /** * List of map tracks. - * + * * @var array * @version 0.1.6 * @since 0.1.6 @@ -281,11 +281,11 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Magic PHP5 method. - * + * *

* Allows object unserialisation. *

- * + * * @throws E_OTS_FileLoaderError When error occurs during file operation. */ public function __wakeup() @@ -296,7 +296,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Loads OTBM file content. - * + * * @version 0.1.0 * @param string $file Filename. * @throws E_OTS_FileLoaderError When error occurs during file operation. @@ -316,7 +316,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Parses loaded file. - * + * * @version 0.1.0 * @throws E_OTS_FileLoaderError When error occurs during file operation. * @throws E_OTS_OutOfBuffer When there is read attemp after end of stream. @@ -476,7 +476,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Loads map's houses list. - * + * * @version 0.1.0 * @since 0.1.0 * @return OTS_HousesList Houses from external file. @@ -488,7 +488,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns map width. - * + * * @return int Map width. */ public function getWidth() @@ -498,7 +498,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns map height. - * + * * @return int Map height. */ public function getHeight() @@ -508,7 +508,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns map description. - * + * * @return string Map description. */ public function getDescription() @@ -518,11 +518,11 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns map waypoints list. - * + * *

* Each item of returned array is sub-array with list of waypoints. *

- * + * * @version 0.1.6 * @since 0.1.6 * @return array List of tracks. @@ -534,7 +534,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Checks if given town ID exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param int $id ID. @@ -547,7 +547,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns town's ID. - * + * * @version 0.1.3 * @param string $name Town. * @return int ID. @@ -567,7 +567,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Checks if given town name exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param string $name Town. @@ -580,7 +580,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns name of given town's ID. - * + * * @version 0.1.3 * @param int $id Town ID. * @return string Name. @@ -607,7 +607,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns town's temple position. - * + * * @param int $id Town id. * @return OTS_MapCoords|bool Point on map (false if not found). */ @@ -625,12 +625,12 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns amount of towns loaded. - * + * * @version 0.0.8 * @since 0.0.8 * @return int Count of towns. */ - public function count() + public function count(): int { return count($this->towns); } @@ -690,7 +690,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns iterator handle for loops. - * + * * @version 0.1.0 * @since 0.1.0 * @return ArrayIterator Towns list iterator. @@ -702,7 +702,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Checks if given element exists. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -724,7 +724,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns item from given position. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -754,7 +754,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to towns list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -768,7 +768,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to towns list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @version 0.1.0 * @since 0.1.0 * @param string|int $offset Array key. @@ -781,7 +781,7 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Magic PHP5 method. - * + * * @version 0.1.0 * @since 0.1.0 * @param string $name Property name. @@ -814,11 +814,11 @@ class OTS_OTBMFile extends OTS_FileLoader implements IteratorAggregate, Countabl /** * Returns string representation of object. - * + * *

* If any display driver is currently loaded then it uses it's method. *

- * + * * @version 0.1.3 * @since 0.1.3 * @return string String representation of object. diff --git a/system/libs/pot/OTS_SpellsList.php b/system/libs/pot/OTS_SpellsList.php index c7a91899..8455b7f2 100644 --- a/system/libs/pot/OTS_SpellsList.php +++ b/system/libs/pot/OTS_SpellsList.php @@ -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); } diff --git a/system/libs/pot/OTS_VocationsList.php b/system/libs/pot/OTS_VocationsList.php index 7dc0e32e..36898684 100644 --- a/system/libs/pot/OTS_VocationsList.php +++ b/system/libs/pot/OTS_VocationsList.php @@ -15,7 +15,7 @@ /** * Wrapper for vocations.xml file. - * + * * @package POT * @version 0.1.3 * @example examples/vocations.php vocations.php @@ -25,14 +25,14 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess { /** * List of vocations. - * + * * @var array */ private $vocations = array(); /** * Loads vocations list from given file. - * + * * @param string $file vocations.xml file location. * @throws DOMException On DOM operation error. */ @@ -51,11 +51,11 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Magic PHP5 method. - * + * *

* Allows object importing from {@link http://www.php.net/manual/en/function.var-export.php var_export()}. *

- * + * * @param array $properties List of object properties. * @throws DOMException On DOM operation error. */ @@ -74,7 +74,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Checks if given vocation ID exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param int $id ID. @@ -87,7 +87,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Returns vocation's ID. - * + * * @version 0.1.3 * @param string $name Vocation. * @return int ID. @@ -108,7 +108,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Checks if given vocation name exists on list. - * + * * @version 0.1.3 * @since 0.1.3 * @param string $name Vocation. @@ -121,7 +121,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Returns name of given vocation's ID. - * + * * @version 0.1.3 * @param int $id Vocation ID. * @return string Name. @@ -139,17 +139,17 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Returns amount of vocations loaded. - * + * * @return int Count of vocations. */ - public function count() + public function count(): int { return count($this->vocations); } /** * Returns iterator handle for loops. - * + * * @return ArrayIterator Vocations list iterator. */ public function getIterator() @@ -159,7 +159,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Checks if given element exists. - * + * * @version 0.1.3 * @param string|int $offset Array key. * @return bool True if it's set. @@ -178,7 +178,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * Returns item from given position. - * + * * @version 0.1.3 * @param string|int $offset Array key. * @return string|int If key is an integer (type-sensitive!) then returns vocation name. If it's a string then return associated ID. @@ -197,7 +197,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to vocations list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @param string|int $offset Array key. * @param mixed $value Field value. * @throws E_OTS_ReadOnly Always - this class is read-only. @@ -209,7 +209,7 @@ class OTS_VocationsList implements IteratorAggregate, Countable, ArrayAccess /** * This method is implemented for ArrayAccess interface. In fact you can't write/append to vocations list. Any call to this method will cause {@link E_OTS_ReadOnly E_OTS_ReadOnly} raise. - * + * * @param string|int $offset Array key. * @throws E_OTS_ReadOnly Always - this class is read-only. */