diff --git a/src/inventory/Inventory.php b/src/inventory/Inventory.php index fa45d4a78..230f6aa49 100644 --- a/src/inventory/Inventory.php +++ b/src/inventory/Inventory.php @@ -47,12 +47,20 @@ interface Inventory{ public function setItem(int $index, Item $item) : void; /** + * Returns an array of all the itemstacks in the inventory, indexed by their slot number. + * Empty slots are not included unless includeEmpty is true. + * * @return Item[] + * @phpstan-return array */ public function getContents(bool $includeEmpty = false) : array; /** + * Sets the contents of the inventory. Non-numeric offsets or offsets larger than the size of the inventory are + * ignored. + * * @param Item[] $items + * @phpstan-param array $items */ public function setContents(array $items) : void; @@ -85,8 +93,10 @@ interface Inventory{ /** * Will return all the Items that has the same id and metadata (if not null). * Won't check amount + * The returned array is indexed by slot number. * * @return Item[] + * @phpstan-return array */ public function all(Item $item) : array; diff --git a/src/inventory/SimpleInventory.php b/src/inventory/SimpleInventory.php index 95ed29c24..aae11c84c 100644 --- a/src/inventory/SimpleInventory.php +++ b/src/inventory/SimpleInventory.php @@ -58,6 +58,7 @@ class SimpleInventory extends BaseInventory{ /** * @return Item[] + * @phpstan-return array */ public function getContents(bool $includeEmpty = false) : array{ $contents = [];