PHP 8.1 compatibility

This commit is contained in:
slawkens
2023-02-02 16:16:06 +01:00
parent d691148c84
commit 0a3a079b86
15 changed files with 159 additions and 152 deletions

View File

@@ -15,11 +15,11 @@
/**
* Container item representation.
*
*
* <p>
* 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).
* </p>
*
*
* @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.
*
*
* <p>
* Passed item must be exacly instance of item which is stored in container, not it's copy. This method bases on PHP references.
* </p>
*
*
* @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.
*
*
* <p>
* 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.
* </p>
*
*
* @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
*/