From 2f4943ac905499bba8771b266acc20f07dd5412f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 4 Jun 2017 14:27:30 +0100 Subject: [PATCH] Fixed some doc issues --- src/pocketmine/Player.php | 1 + src/pocketmine/inventory/BaseInventory.php | 10 ++-------- src/pocketmine/inventory/Inventory.php | 8 ++++---- src/pocketmine/level/Level.php | 2 +- src/pocketmine/utils/UUID.php | 4 ++-- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 1558c7f8b..78c0b3fb2 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1243,6 +1243,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade * TODO: remove this when Spectator Mode gets added properly to MCPE * * @param int $gamemode + * @return int */ public static function getClientFriendlyGamemode(int $gamemode) : int{ $gamemode &= 0x03; diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index 74379b966..aa336a9d4 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -243,14 +243,11 @@ abstract class BaseInventory implements Inventory{ return false; } - public function addItem(...$slots){ + public function addItem(Item ...$slots){ /** @var Item[] $itemSlots */ /** @var Item[] $slots */ $itemSlots = []; foreach($slots as $slot){ - if(!($slot instanceof Item)){ - throw new \InvalidArgumentException("Expected Item[], got " . gettype($slot)); - } if($slot->getId() !== 0 and $slot->getCount() > 0){ $itemSlots[] = clone $slot; } @@ -303,14 +300,11 @@ abstract class BaseInventory implements Inventory{ return $itemSlots; } - public function removeItem(...$slots){ + public function removeItem(Item ...$slots){ /** @var Item[] $itemSlots */ /** @var Item[] $slots */ $itemSlots = []; foreach($slots as $slot){ - if(!($slot instanceof Item)){ - throw new \InvalidArgumentException("Expected Item[], got " . gettype($slot)); - } if($slot->getId() !== 0 and $slot->getCount() > 0){ $itemSlots[] = clone $slot; } diff --git a/src/pocketmine/inventory/Inventory.php b/src/pocketmine/inventory/Inventory.php index f5f964d4e..904f0e596 100644 --- a/src/pocketmine/inventory/Inventory.php +++ b/src/pocketmine/inventory/Inventory.php @@ -68,11 +68,11 @@ interface Inventory{ * * Returns the Items that did not fit. * - * @param Item ...$slots + * @param Item[] ...$slots * * @return Item[] */ - public function addItem(...$slots); + public function addItem(Item ...$slots); /** * Checks if a given Item can be added to the inventory @@ -87,11 +87,11 @@ interface Inventory{ * Removes the given Item from the inventory. * It will return the Items that couldn't be removed. * - * @param Item ...$slots + * @param Item[] ...$slots * * @return Item[] */ - public function removeItem(...$slots); + public function removeItem(Item ...$slots); /** * @return Item[] diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 845362a06..855625cfd 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -672,7 +672,7 @@ class Level implements ChunkManager, Metadatable{ * WARNING: Do not use this, it's only for internal use. * Changes to this function won't be recorded on the version. * - * @param Player ...$targets If empty, will send to all players in the level. + * @param Player[] ...$targets If empty, will send to all players in the level. */ public function sendTime(Player ...$targets){ $pk = new SetTimePacket(); diff --git a/src/pocketmine/utils/UUID.php b/src/pocketmine/utils/UUID.php index 3b6118257..ebc42688c 100644 --- a/src/pocketmine/utils/UUID.php +++ b/src/pocketmine/utils/UUID.php @@ -72,10 +72,10 @@ class UUID{ /** * Creates an UUIDv3 from binary data or list of binary data * - * @param string ...$data + * @param string[] ...$data * @return UUID */ - public static function fromData(...$data){ + public static function fromData(string ...$data){ $hash = hash("md5", implode($data), true); return self::fromBinary($hash, 3);