PHP 8.1 compatibility

This commit is contained in:
slawkens
2023-02-02 16:16:06 +01:00
parent 9de8145f82
commit 8c801dddec
16 changed files with 160 additions and 153 deletions

View File

@@ -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.
*
*
* <p>
* Allows object importing from {@link http://www.php.net/manual/en/function.var-export.php var_export()}.
* </p>
*
*
* @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.
*/