Mass removal of useless @param/@return PHPDoc annotations, pass 1

This commit is contained in:
Dylan K. Taylor
2020-01-21 15:10:18 +00:00
parent 7532c609fb
commit c4793241f5
322 changed files with 0 additions and 5360 deletions

View File

@ -94,12 +94,7 @@ class Item implements ItemIds, \JsonSerializable{
*
* This function redirects to {@link ItemFactory#get}.
*
* @param int $id
* @param int $meta
* @param int $count
* @param CompoundTag|string $tags
*
* @return Item
*/
public static function get(int $id, int $meta = 0, int $count = 1, $tags = "") : Item{
return ItemFactory::get($id, $meta, $count, $tags);
@ -110,9 +105,6 @@ class Item implements ItemIds, \JsonSerializable{
*
* This function redirects to {@link ItemFactory#fromString}.
*
* @param string $str
* @param bool $multiple
*
* @return Item[]|Item
*/
public static function fromString(string $str, bool $multiple = false){
@ -158,8 +150,6 @@ class Item implements ItemIds, \JsonSerializable{
* Adds an item to the creative menu.
* Note: Players who are already online when this is called will not see this change.
*
* @param Item $item
*
* @return void
*/
public static function addCreativeItem(Item $item){
@ -170,8 +160,6 @@ class Item implements ItemIds, \JsonSerializable{
* Removes an item from the creative menu.
* Note: Players who are already online when this is called will not see this change.
*
* @param Item $item
*
* @return void
*/
public static function removeCreativeItem(Item $item){
@ -186,8 +174,6 @@ class Item implements ItemIds, \JsonSerializable{
}
/**
* @param int $index
*
* @return Item|null
*/
public static function getCreativeItem(int $index){
@ -223,10 +209,6 @@ class Item implements ItemIds, \JsonSerializable{
*
* NOTE: This should NOT BE USED for creating items to set into an inventory. Use {@link ItemFactory#get} for that
* purpose.
*
* @param int $id
* @param int $meta
* @param string $name
*/
public function __construct(int $id, int $meta = 0, string $name = "Unknown"){
if($id < -0x8000 or $id > 0x7fff){ //signed short range
@ -260,7 +242,6 @@ class Item implements ItemIds, \JsonSerializable{
* @see Item::getNamedTag()
*
* Returns the serialized NBT of the Item
* @return string
*/
public function getCompoundTag() : string{
return $this->tags;
@ -268,15 +249,11 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns whether this Item has a non-empty NBT.
* @return bool
*/
public function hasCompoundTag() : bool{
return $this->tags !== "";
}
/**
* @return bool
*/
public function hasCustomBlockData() : bool{
return $this->getNamedTagEntry(self::TAG_BLOCK_ENTITY_TAG) instanceof CompoundTag;
}
@ -290,8 +267,6 @@ class Item implements ItemIds, \JsonSerializable{
}
/**
* @param CompoundTag $compound
*
* @return $this
*/
public function setCustomBlockData(CompoundTag $compound) : Item{
@ -302,27 +277,15 @@ class Item implements ItemIds, \JsonSerializable{
return $this;
}
/**
* @return CompoundTag|null
*/
public function getCustomBlockData() : ?CompoundTag{
$tag = $this->getNamedTagEntry(self::TAG_BLOCK_ENTITY_TAG);
return $tag instanceof CompoundTag ? $tag : null;
}
/**
* @return bool
*/
public function hasEnchantments() : bool{
return $this->getNamedTagEntry(self::TAG_ENCH) instanceof ListTag;
}
/**
* @param int $id
* @param int $level
*
* @return bool
*/
public function hasEnchantment(int $id, int $level = -1) : bool{
$ench = $this->getNamedTagEntry(self::TAG_ENCH);
if(!($ench instanceof ListTag)){
@ -339,11 +302,6 @@ class Item implements ItemIds, \JsonSerializable{
return false;
}
/**
* @param int $id
*
* @return EnchantmentInstance|null
*/
public function getEnchantment(int $id) : ?EnchantmentInstance{
$ench = $this->getNamedTagEntry(self::TAG_ENCH);
if(!($ench instanceof ListTag)){
@ -363,10 +321,6 @@ class Item implements ItemIds, \JsonSerializable{
return null;
}
/**
* @param int $id
* @param int $level
*/
public function removeEnchantment(int $id, int $level = -1) : void{
$ench = $this->getNamedTagEntry(self::TAG_ENCH);
if(!($ench instanceof ListTag)){
@ -388,9 +342,6 @@ class Item implements ItemIds, \JsonSerializable{
$this->removeNamedTagEntry(self::TAG_ENCH);
}
/**
* @param EnchantmentInstance $enchantment
*/
public function addEnchantment(EnchantmentInstance $enchantment) : void{
$found = false;
@ -445,10 +396,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns the level of the enchantment on this item with the specified ID, or 0 if the item does not have the
* enchantment.
*
* @param int $enchantmentId
*
* @return int
*/
public function getEnchantmentLevel(int $enchantmentId) : int{
$ench = $this->getNamedTag()->getListTag(self::TAG_ENCH);
@ -464,9 +411,6 @@ class Item implements ItemIds, \JsonSerializable{
return 0;
}
/**
* @return bool
*/
public function hasCustomName() : bool{
$display = $this->getNamedTagEntry(self::TAG_DISPLAY);
if($display instanceof CompoundTag){
@ -476,9 +420,6 @@ class Item implements ItemIds, \JsonSerializable{
return false;
}
/**
* @return string
*/
public function getCustomName() : string{
$display = $this->getNamedTagEntry(self::TAG_DISPLAY);
if($display instanceof CompoundTag){
@ -489,8 +430,6 @@ class Item implements ItemIds, \JsonSerializable{
}
/**
* @param string $name
*
* @return $this
*/
public function setCustomName(string $name) : Item{
@ -560,11 +499,6 @@ class Item implements ItemIds, \JsonSerializable{
return $this;
}
/**
* @param string $name
*
* @return NamedTag|null
*/
public function getNamedTagEntry(string $name) : ?NamedTag{
return $this->getNamedTag()->getTag($name);
}
@ -584,8 +518,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns a tree of Tag objects representing the Item's NBT. If the item does not have any NBT, an empty CompoundTag
* object is returned to allow the caller to manipulate and apply back to the item.
*
* @return CompoundTag
*/
public function getNamedTag() : CompoundTag{
if(!$this->hasCompoundTag() and $this->cachedNBT === null){
@ -598,8 +530,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Sets the Item's NBT from the supplied CompoundTag object.
*
* @param CompoundTag $tag
*
* @return $this
*/
public function setNamedTag(CompoundTag $tag) : Item{
@ -621,16 +551,11 @@ class Item implements ItemIds, \JsonSerializable{
return $this->setCompoundTag("");
}
/**
* @return int
*/
public function getCount() : int{
return $this->count;
}
/**
* @param int $count
*
* @return $this
*/
public function setCount(int $count) : Item{
@ -642,8 +567,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Pops an item from the stack and returns it, decreasing the stack count of this item stack by one.
*
* @param int $count
*
* @return $this
* @throws \InvalidArgumentException if trying to pop more items than are on the stack
*/
@ -666,7 +589,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns the name of the item, or the custom name if it is set.
* @return string
*/
final public function getName() : string{
return $this->hasCustomName() ? $this->getCustomName() : $this->getVanillaName();
@ -674,44 +596,31 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns the vanilla name of the item, disregarding custom names.
* @return string
*/
public function getVanillaName() : string{
return $this->name;
}
/**
* @return bool
*/
final public function canBePlaced() : bool{
return $this->getBlock()->canBePlaced();
}
/**
* Returns the block corresponding to this Item.
* @return Block
*/
public function getBlock() : Block{
return BlockFactory::get(self::AIR);
}
/**
* @return int
*/
final public function getId() : int{
return $this->id;
}
/**
* @return int
*/
final public function getDamage() : int{
return $this->meta;
}
/**
* @param int $meta
*
* @return $this
*/
public function setDamage(int $meta) : Item{
@ -723,8 +632,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns whether this item can match any item with an equivalent ID with any meta value.
* Used in crafting recipes which accept multiple variants of the same item, for example crafting tables recipes.
*
* @return bool
*/
public function hasAnyDamageValue() : bool{
return $this->meta === -1;
@ -732,7 +639,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns the highest amount of this item which will fit into one inventory slot.
* @return int
*/
public function getMaxStackSize() : int{
return 64;
@ -740,7 +646,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns the time in ticks which the item will fuel a furnace for.
* @return int
*/
public function getFuelTime() : int{
return 0;
@ -748,7 +653,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns how many points of damage this item will deal to an entity when used as a weapon.
* @return int
*/
public function getAttackPoints() : int{
return 1;
@ -756,7 +660,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns how many armor points can be gained by wearing this item.
* @return int
*/
public function getDefensePoints() : int{
return 0;
@ -765,8 +668,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns what type of block-breaking tool this is. Blocks requiring the same tool type as the item will break
* faster (except for blocks requiring no tool, which break at the same speed regardless of the tool used)
*
* @return int
*/
public function getBlockToolType() : int{
return BlockToolType::TYPE_NONE;
@ -778,8 +679,6 @@ class Item implements ItemIds, \JsonSerializable{
* This should return 1 for non-tiered tools, and the tool tier for tiered tools.
*
* @see Block::getToolHarvestLevel()
*
* @return int
*/
public function getBlockToolHarvestLevel() : int{
return 0;
@ -791,14 +690,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Called when a player uses this item on a block.
*
* @param Player $player
* @param Block $blockReplace
* @param Block $blockClicked
* @param int $face
* @param Vector3 $clickVector
*
* @return bool
*/
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : bool{
return false;
@ -807,11 +698,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Called when a player uses the item on air, for example throwing a projectile.
* Returns whether the item was changed, for example count decrease or durability change.
*
* @param Player $player
* @param Vector3 $directionVector
*
* @return bool
*/
public function onClickAir(Player $player, Vector3 $directionVector) : bool{
return false;
@ -820,10 +706,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Called when a player is using this item and releases it. Used to handle bow shoot actions.
* Returns whether the item was changed, for example count decrease or durability change.
*
* @param Player $player
*
* @return bool
*/
public function onReleaseUsing(Player $player) : bool{
return false;
@ -831,10 +713,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Called when this item is used to destroy a block. Usually used to update durability.
*
* @param Block $block
*
* @return bool
*/
public function onDestroyBlock(Block $block) : bool{
return false;
@ -842,10 +720,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Called when this item is used to attack an entity. Usually used to update durability.
*
* @param Entity $victim
*
* @return bool
*/
public function onAttackEntity(Entity $victim) : bool{
return false;
@ -853,8 +727,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns the number of ticks a player must wait before activating this item again.
*
* @return int
*/
public function getCooldownTicks() : int{
return 0;
@ -863,11 +735,8 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Compares an Item to this Item and check if they match.
*
* @param Item $item
* @param bool $checkDamage Whether to verify that the damage values match.
* @param bool $checkCompound Whether to verify that the items' NBT match.
*
* @return bool
*/
final public function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true) : bool{
if($this->id === $item->getId() and (!$checkDamage or $this->getDamage() === $item->getDamage())){
@ -888,26 +757,17 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns whether the specified item stack has the same ID, damage, NBT and count as this item stack.
*
* @param Item $other
*
* @return bool
*/
final public function equalsExact(Item $other) : bool{
return $this->equals($other, true, true) and $this->count === $other->count;
}
/**
* @return string
*/
final public function __toString() : string{
return "Item " . $this->name . " (" . $this->id . ":" . ($this->hasAnyDamageValue() ? "?" : $this->meta) . ")x" . $this->count . ($this->hasCompoundTag() ? " tags:" . base64_encode($this->getCompoundTag()) : "");
}
/**
* Returns an array of item stack properties that can be serialized to json.
*
* @return array
*/
final public function jsonSerialize() : array{
$data = [
@ -931,10 +791,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Returns an Item from properties created in an array by {@link Item#jsonSerialize}
*
* @param array $data
*
* @return Item
*/
final public static function jsonDeserialize(array $data) : Item{
$nbt = "";
@ -960,8 +816,6 @@ class Item implements ItemIds, \JsonSerializable{
*
* @param int $slot optional, the inventory slot of the item
* @param string $tagName the name to assign to the CompoundTag object
*
* @return CompoundTag
*/
public function nbtSerialize(int $slot = -1, string $tagName = "") : CompoundTag{
$result = new CompoundTag($tagName, [
@ -985,10 +839,6 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Deserializes an Item from an NBT CompoundTag
*
* @param CompoundTag $tag
*
* @return Item
*/
public static function nbtDeserialize(CompoundTag $tag) : Item{
if(!$tag->hasTag("id") or !$tag->hasTag("Count")){