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

@ -73,7 +73,6 @@ abstract class BaseInventory implements Inventory{
/**
* Returns the size of the inventory.
* @return int
*/
public function getSize() : int{
return $this->slots->getSize();
@ -83,8 +82,6 @@ abstract class BaseInventory implements Inventory{
* Sets the new size of the inventory.
* WARNING: If the size is smaller, any items past the new size will be lost.
*
* @param int $size
*
* @return void
*/
public function setSize(int $size){
@ -102,8 +99,6 @@ abstract class BaseInventory implements Inventory{
}
/**
* @param bool $includeEmpty
*
* @return Item[]
*/
public function getContents(bool $includeEmpty = false) : array{
@ -123,7 +118,6 @@ abstract class BaseInventory implements Inventory{
/**
* @param Item[] $items
* @param bool $send
*/
public function setContents(array $items, bool $send = true) : void{
if(count($items) > $this->getSize()){
@ -150,9 +144,6 @@ abstract class BaseInventory implements Inventory{
/**
* Drops the contents of the inventory into the specified Level at the specified position and clears the inventory
* contents.
*
* @param Level $level
* @param Vector3 $position
*/
public function dropContents(Level $level, Vector3 $position) : void{
foreach($this->getContents() as $item){
@ -455,7 +446,6 @@ abstract class BaseInventory implements Inventory{
}
/**
* @param int $index
* @param Player|Player[] $target
*/
public function sendSlot(int $index, $target) : void{

View File

@ -35,9 +35,6 @@ class ChestInventory extends ContainerInventory{
/** @var Chest */
protected $holder;
/**
* @param Chest $tile
*/
public function __construct(Chest $tile){
parent::__construct($tile);
}

View File

@ -70,7 +70,6 @@ abstract class ContainerInventory extends BaseInventory{
/**
* Returns the Minecraft PE inventory type used to show the inventory window to clients.
* @return int
*/
abstract public function getNetworkType() : int;

View File

@ -129,11 +129,6 @@ class CraftingGrid extends BaseInventory{
/**
* Returns the item at offset x,y, offset by where the starts of the recipe rectangle are.
*
* @param int $x
* @param int $y
*
* @return Item
*/
public function getIngredient(int $x, int $y) : Item{
if($this->startX !== null and $this->startY !== null){
@ -145,8 +140,6 @@ class CraftingGrid extends BaseInventory{
/**
* Returns the width of the recipe we're trying to craft, based on items currently in the grid.
*
* @return int
*/
public function getRecipeWidth() : int{
return $this->xLen ?? 0;
@ -154,7 +147,6 @@ class CraftingGrid extends BaseInventory{
/**
* Returns the height of the recipe we're trying to craft, based on items currently in the grid.
* @return int
*/
public function getRecipeHeight() : int{
return $this->yLen ?? 0;

View File

@ -128,8 +128,6 @@ class CraftingManager{
/**
* Returns a pre-compressed CraftingDataPacket for sending to players. Rebuilds the cache if it is not found.
*
* @return BatchPacket
*/
public function getCraftingDataPacket() : BatchPacket{
if($this->craftingDataCache === null){
@ -142,9 +140,6 @@ class CraftingManager{
/**
* Function used to arrange Shapeless Recipe ingredient lists into a consistent order.
*
* @param Item $i1
* @param Item $i2
*
* @return int
*/
public static function sort(Item $i1, Item $i2){
@ -210,27 +205,18 @@ class CraftingManager{
return $this->furnaceRecipes;
}
/**
* @param ShapedRecipe $recipe
*/
public function registerShapedRecipe(ShapedRecipe $recipe) : void{
$this->shapedRecipes[self::hashOutputs($recipe->getResults())][] = $recipe;
$this->craftingDataCache = null;
}
/**
* @param ShapelessRecipe $recipe
*/
public function registerShapelessRecipe(ShapelessRecipe $recipe) : void{
$this->shapelessRecipes[self::hashOutputs($recipe->getResults())][] = $recipe;
$this->craftingDataCache = null;
}
/**
* @param FurnaceRecipe $recipe
*/
public function registerFurnaceRecipe(FurnaceRecipe $recipe) : void{
$input = $recipe->getInput();
$this->furnaceRecipes[$input->getId() . ":" . ($input->hasAnyDamageValue() ? "?" : $input->getDamage())] = $recipe;
@ -238,10 +224,7 @@ class CraftingManager{
}
/**
* @param CraftingGrid $grid
* @param Item[] $outputs
*
* @return CraftingRecipe|null
*/
public function matchRecipe(CraftingGrid $grid, array $outputs) : ?CraftingRecipe{
//TODO: try to match special recipes before anything else (first they need to be implemented!)
@ -290,18 +273,10 @@ class CraftingManager{
}
}
/**
* @param Item $input
*
* @return FurnaceRecipe|null
*/
public function matchFurnaceRecipe(Item $input) : ?FurnaceRecipe{
return $this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()] ?? $this->furnaceRecipes[$input->getId() . ":?"] ?? null;
}
/**
* @param Recipe $recipe
*/
public function registerRecipe(Recipe $recipe) : void{
$recipe->registerToCraftingManager($this);
}

View File

@ -36,18 +36,12 @@ interface CraftingRecipe extends Recipe{
/**
* Returns a list of results this recipe will produce when the inputs in the given crafting grid are consumed.
*
* @param CraftingGrid $grid
*
* @return Item[]
*/
public function getResultsFor(CraftingGrid $grid) : array;
/**
* Returns whether the given crafting grid meets the requirements to craft this recipe.
*
* @param CraftingGrid $grid
*
* @return bool
*/
public function matchesCraftingGrid(CraftingGrid $grid) : bool;
}

View File

@ -88,7 +88,6 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
/**
* @param Item[] $items
* @param bool $send
*/
public function setContents(array $items, bool $send = true) : void{
$size = $this->getSize();
@ -128,16 +127,10 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
parent::onClose($who);
}
/**
* @return ChestInventory
*/
public function getLeftSide() : ChestInventory{
return $this->left;
}
/**
* @return ChestInventory
*/
public function getRightSide() : ChestInventory{
return $this->right;
}

View File

@ -52,8 +52,6 @@ class EnderChestInventory extends ChestInventory{
/**
* Set the holder's position to that of a tile
*
* @param EnderChest $enderChest
*
* @return void
*/
public function setHolderPosition(EnderChest $enderChest){

View File

@ -55,50 +55,26 @@ class FurnaceInventory extends ContainerInventory{
return $this->holder;
}
/**
* @return Item
*/
public function getResult() : Item{
return $this->getItem(2);
}
/**
* @return Item
*/
public function getFuel() : Item{
return $this->getItem(1);
}
/**
* @return Item
*/
public function getSmelting() : Item{
return $this->getItem(0);
}
/**
* @param Item $item
*
* @return bool
*/
public function setResult(Item $item) : bool{
return $this->setItem(2, $item);
}
/**
* @param Item $item
*
* @return bool
*/
public function setFuel(Item $item) : bool{
return $this->setItem(1, $item);
}
/**
* @param Item $item
*
* @return bool
*/
public function setSmelting(Item $item) : bool{
return $this->setItem(0, $item);
}

View File

@ -33,34 +33,22 @@ class FurnaceRecipe implements Recipe{
/** @var Item */
private $ingredient;
/**
* @param Item $result
* @param Item $ingredient
*/
public function __construct(Item $result, Item $ingredient){
$this->output = clone $result;
$this->ingredient = clone $ingredient;
}
/**
* @param Item $item
*
* @return void
*/
public function setInput(Item $item){
$this->ingredient = clone $item;
}
/**
* @return Item
*/
public function getInput() : Item{
return clone $this->ingredient;
}
/**
* @return Item
*/
public function getResult() : Item{
return clone $this->output;
}

View File

@ -34,47 +34,21 @@ use pocketmine\Player;
interface Inventory{
public const MAX_STACK = 64;
/**
* @return int
*/
public function getSize() : int;
/**
* @return int
*/
public function getMaxStackSize() : int;
/**
* @param int $size
*/
public function setMaxStackSize(int $size) : void;
/**
* @return string
*/
public function getName() : string;
/**
* @return string
*/
public function getTitle() : string;
/**
* @param int $index
*
* @return Item
*/
public function getItem(int $index) : Item;
/**
* Puts an Item in a slot.
* If a plugin refuses the update or $index is invalid, it'll return false
*
* @param int $index
* @param Item $item
* @param bool $send
*
* @return bool
*/
public function setItem(int $index, Item $item, bool $send = true) : bool;
@ -92,10 +66,6 @@ interface Inventory{
/**
* Checks if a given Item can be added to the inventory
*
* @param Item $item
*
* @return bool
*/
public function canAddItem(Item $item) : bool;
@ -110,24 +80,18 @@ interface Inventory{
public function removeItem(Item ...$slots) : array;
/**
* @param bool $includeEmpty
*
* @return Item[]
*/
public function getContents(bool $includeEmpty = false) : array;
/**
* @param Item[] $items
* @param bool $send
*/
public function setContents(array $items, bool $send = true) : void;
/**
* Drops the contents of the inventory into the specified Level at the specified position and clears the inventory
* contents.
*
* @param Level $level
* @param Vector3 $position
*/
public function dropContents(Level $level, Vector3 $position) : void;
@ -137,7 +101,6 @@ interface Inventory{
public function sendContents($target) : void;
/**
* @param int $index
* @param Player|Player[] $target
*/
public function sendSlot(int $index, $target) : void;
@ -145,10 +108,6 @@ interface Inventory{
/**
* Checks if the inventory contains any Item with the same material data.
* It will check id, amount, and metadata (if not null)
*
* @param Item $item
*
* @return bool
*/
public function contains(Item $item) : bool;
@ -156,8 +115,6 @@ interface Inventory{
* Will return all the Items that has the same id and metadata (if not null).
* Won't check amount
*
* @param Item $item
*
* @return Item[]
*/
public function all(Item $item) : array;
@ -167,51 +124,31 @@ interface Inventory{
* and count >= to the count of the specified item stack.
*
* If $exact is true, only items with equal ID, damage, NBT and count will match.
*
* @param Item $item
* @param bool $exact
*
* @return int
*/
public function first(Item $item, bool $exact = false) : int;
/**
* Returns the first empty slot, or -1 if not found
*
* @return int
*/
public function firstEmpty() : int;
/**
* Returns whether the given slot is empty.
*
* @param int $index
*
* @return bool
*/
public function isSlotEmpty(int $index) : bool;
/**
* Will remove all the Items that has the same id and metadata (if not null)
*
* @param Item $item
*/
public function remove(Item $item) : void;
/**
* Will clear a specific slot
*
* @param int $index
* @param bool $send
*
* @return bool
*/
public function clear(int $index, bool $send = true) : bool;
/**
* Clears all the slots
*
* @param bool $send
*/
public function clearAll(bool $send = true) : void;
@ -223,50 +160,25 @@ interface Inventory{
*/
public function getViewers() : array;
/**
* @param Player $who
*/
public function onOpen(Player $who) : void;
/**
* Tries to open the inventory to a player
*
* @param Player $who
*
* @return bool
*/
public function open(Player $who) : bool;
public function close(Player $who) : void;
/**
* @param Player $who
*/
public function onClose(Player $who) : void;
/**
* @param int $index
* @param Item $before
* @param bool $send
*/
public function onSlotChange(int $index, Item $before, bool $send) : void;
/**
* Returns whether the specified slot exists in the inventory.
*
* @param int $slot
*
* @return bool
*/
public function slotExists(int $slot) : bool;
/**
* @return null|InventoryEventProcessor
*/
public function getEventProcessor() : ?InventoryEventProcessor;
/**
* @param null|InventoryEventProcessor $eventProcessor
*/
public function setEventProcessor(?InventoryEventProcessor $eventProcessor) : void;
}

View File

@ -37,11 +37,6 @@ interface InventoryEventProcessor{
* Called prior to a slot in the given inventory changing. This is called by inventories that this listener is
* attached to.
*
* @param Inventory $inventory
* @param int $slot
* @param Item $oldItem
* @param Item $newItem
*
* @return Item|null that should be used in place of $newItem, or null if the slot change should not proceed.
*/
public function onSlotChange(Inventory $inventory, int $slot, Item $oldItem, Item $newItem) : ?Item;

View File

@ -41,9 +41,6 @@ class PlayerInventory extends BaseInventory{
/** @var int */
protected $itemInHandIndex = 0;
/**
* @param Human $player
*/
public function __construct(Human $player){
$this->holder = $player;
parent::__construct();
@ -93,8 +90,6 @@ class PlayerInventory extends BaseInventory{
}
/**
* @param int $slot
*
* @throws \InvalidArgumentException
*/
private function throwIfNotHotbarSlot(int $slot) : void{
@ -106,10 +101,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the item in the specified hotbar slot.
*
* @param int $hotbarSlot
*
* @return Item
*
* @throws \InvalidArgumentException if the hotbar slot index is out of range
*/
public function getHotbarSlotItem(int $hotbarSlot) : Item{
@ -119,7 +110,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the hotbar slot number the holder is currently holding.
* @return int
*/
public function getHeldItemIndex() : int{
return $this->itemInHandIndex;
@ -149,8 +139,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the currently-held item.
*
* @return Item
*/
public function getItemInHand() : Item{
return $this->getHotbarSlotItem($this->itemInHandIndex);
@ -158,10 +146,6 @@ class PlayerInventory extends BaseInventory{
/**
* Sets the item in the currently-held slot to the specified item.
*
* @param Item $item
*
* @return bool
*/
public function setItemInHand(Item $item) : bool{
return $this->setItem($this->getHeldItemIndex(), $item);
@ -198,7 +182,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the number of slots in the hotbar.
* @return int
*/
public function getHotbarSize() : int{
return 9;

View File

@ -110,8 +110,6 @@ class ShapedRecipe implements CraftingRecipe{
}
/**
* @param CraftingGrid $grid
*
* @return Item[]
*/
public function getResultsFor(CraftingGrid $grid) : array{
@ -119,9 +117,6 @@ class ShapedRecipe implements CraftingRecipe{
}
/**
* @param string $key
* @param Item $item
*
* @return $this
* @throws \InvalidArgumentException
*/
@ -168,12 +163,6 @@ class ShapedRecipe implements CraftingRecipe{
return $ingredients;
}
/**
* @param int $x
* @param int $y
*
* @return Item
*/
public function getIngredient(int $x, int $y) : Item{
$exists = $this->ingredientList[$this->shape[$y]{$x}] ?? null;
return $exists !== null ? clone $exists : ItemFactory::get(Item::AIR, 0, 0);
@ -191,12 +180,6 @@ class ShapedRecipe implements CraftingRecipe{
$manager->registerShapedRecipe($this);
}
/**
* @param CraftingGrid $grid
* @param bool $reverse
*
* @return bool
*/
private function matchInputMap(CraftingGrid $grid, bool $reverse) : bool{
for($y = 0; $y < $this->height; ++$y){
for($x = 0; $x < $this->width; ++$x){
@ -212,11 +195,6 @@ class ShapedRecipe implements CraftingRecipe{
return true;
}
/**
* @param CraftingGrid $grid
*
* @return bool
*/
public function matchesCraftingGrid(CraftingGrid $grid) : bool{
if($this->width !== $grid->getRecipeWidth() or $this->height !== $grid->getRecipeHeight()){
return false;

View File

@ -55,10 +55,6 @@ class ShapelessRecipe implements CraftingRecipe{
}
/**
* @param Item $item
*
* @return ShapelessRecipe
*
* @throws \InvalidArgumentException
*/
public function addIngredient(Item $item) : ShapelessRecipe{
@ -74,8 +70,6 @@ class ShapelessRecipe implements CraftingRecipe{
}
/**
* @param Item $item
*
* @return $this
*/
public function removeIngredient(Item $item){
@ -99,9 +93,6 @@ class ShapelessRecipe implements CraftingRecipe{
return array_map(function(Item $item) : Item{ return clone $item; }, $this->ingredients);
}
/**
* @return int
*/
public function getIngredientCount() : int{
$count = 0;
foreach($this->ingredients as $ingredient){
@ -115,11 +106,6 @@ class ShapelessRecipe implements CraftingRecipe{
$manager->registerShapelessRecipe($this);
}
/**
* @param CraftingGrid $grid
*
* @return bool
*/
public function matchesCraftingGrid(CraftingGrid $grid) : bool{
//don't pack the ingredients - shapeless recipes require that each ingredient be in a separate slot
$input = $grid->getContents();

View File

@ -61,10 +61,7 @@ class CraftingTransaction extends InventoryTransaction{
/**
* @param Item[] $txItems
* @param Item[] $recipeItems
* @param bool $wildcards
* @param int $iterations
*
* @return int
* @throws TransactionValidationException
*/
protected function matchRecipeItems(array $txItems, array $recipeItems, bool $wildcards, int $iterations = 0) : int{

View File

@ -65,7 +65,6 @@ class InventoryTransaction{
protected $actions = [];
/**
* @param Player $source
* @param InventoryAction[] $actions
*/
public function __construct(Player $source, array $actions = []){
@ -75,9 +74,6 @@ class InventoryTransaction{
}
}
/**
* @return Player
*/
public function getSource() : Player{
return $this->source;
}
@ -101,9 +97,6 @@ class InventoryTransaction{
return $this->actions;
}
/**
* @param InventoryAction $action
*/
public function addAction(InventoryAction $action) : void{
if(!isset($this->actions[$hash = spl_object_hash($action)])){
$this->actions[$hash] = $action;
@ -129,8 +122,6 @@ class InventoryTransaction{
/**
* @internal This method should not be used by plugins, it's used to add tracked inventories for InventoryActions
* involving inventories.
*
* @param Inventory $inventory
*/
public function addInventory(Inventory $inventory) : void{
if(!isset($this->inventories[$hash = spl_object_hash($inventory)])){
@ -232,10 +223,7 @@ class InventoryTransaction{
}
/**
* @param Item $needOrigin
* @param SlotChangeAction[] $possibleActions
*
* @return null|Item
*/
protected function findResultItem(Item $needOrigin, array $possibleActions) : ?Item{
assert(count($possibleActions) > 0);
@ -294,7 +282,6 @@ class InventoryTransaction{
/**
* Executes the group of actions, returning whether the transaction executed successfully or not.
* @return bool
*
* @throws TransactionValidationException
*/
@ -333,9 +320,6 @@ class InventoryTransaction{
return true;
}
/**
* @return bool
*/
public function hasExecuted() : bool{
return $this->hasExecuted;
}

View File

@ -47,10 +47,6 @@ class CreativeInventoryAction extends InventoryAction{
/**
* Checks that the player is in creative, and (if creating an item) that the item exists in the creative inventory.
*
* @param Player $source
*
* @return bool
*/
public function isValid(Player $source) : bool{
return $source->isCreative(true) and
@ -66,10 +62,6 @@ class CreativeInventoryAction extends InventoryAction{
/**
* No need to do anything extra here: this type just provides a place for items to disappear or appear from.
*
* @param Player $source
*
* @return bool
*/
public function execute(Player $source) : bool{
return true;

View File

@ -53,10 +53,6 @@ class DropItemAction extends InventoryAction{
/**
* Drops the target item in front of the player.
*
* @param Player $source
*
* @return bool
*/
public function execute(Player $source) : bool{
return $source->dropItem($this->targetItem);

View File

@ -43,7 +43,6 @@ abstract class InventoryAction{
/**
* Returns the item that was present before the action took place.
* @return Item
*/
public function getSourceItem() : Item{
return clone $this->sourceItem;
@ -51,7 +50,6 @@ abstract class InventoryAction{
/**
* Returns the item that the action attempted to replace the source item with.
* @return Item
*/
public function getTargetItem() : Item{
return clone $this->targetItem;
@ -59,17 +57,11 @@ abstract class InventoryAction{
/**
* Returns whether this action is currently valid. This should perform any necessary sanity checks.
*
* @param Player $source
*
* @return bool
*/
abstract public function isValid(Player $source) : bool;
/**
* Called when the action is added to the specified InventoryTransaction.
*
* @param InventoryTransaction $transaction
*/
public function onAddToTransaction(InventoryTransaction $transaction) : void{
@ -78,10 +70,6 @@ abstract class InventoryAction{
/**
* Called by inventory transactions before any actions are processed. If this returns false, the transaction will
* be cancelled.
*
* @param Player $source
*
* @return bool
*/
public function onPreExecute(Player $source) : bool{
return true;
@ -91,24 +79,16 @@ abstract class InventoryAction{
* Performs actions needed to complete the inventory-action server-side. Returns if it was successful. Will return
* false if plugins cancelled events. This will only be called if the transaction which it is part of is considered
* valid.
*
* @param Player $source
*
* @return bool
*/
abstract public function execute(Player $source) : bool;
/**
* Performs additional actions when this inventory-action completed successfully.
*
* @param Player $source
*/
abstract public function onExecuteSuccess(Player $source) : void;
/**
* Performs additional actions when this inventory-action did not complete successfully.
*
* @param Player $source
*/
abstract public function onExecuteFail(Player $source) : void;

View File

@ -39,12 +39,6 @@ class SlotChangeAction extends InventoryAction{
/** @var int */
private $inventorySlot;
/**
* @param Inventory $inventory
* @param int $inventorySlot
* @param Item $sourceItem
* @param Item $targetItem
*/
public function __construct(Inventory $inventory, int $inventorySlot, Item $sourceItem, Item $targetItem){
parent::__construct($sourceItem, $targetItem);
$this->inventory = $inventory;
@ -53,8 +47,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Returns the inventory involved in this action.
*
* @return Inventory
*/
public function getInventory() : Inventory{
return $this->inventory;
@ -62,7 +54,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Returns the slot in the inventory which this action modified.
* @return int
*/
public function getSlot() : int{
return $this->inventorySlot;
@ -70,10 +61,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Checks if the item in the inventory at the specified slot is the same as this action's source item.
*
* @param Player $source
*
* @return bool
*/
public function isValid(Player $source) : bool{
return (
@ -84,9 +71,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Adds this action's target inventory to the transaction's inventory list.
*
* @param InventoryTransaction $transaction
*
*/
public function onAddToTransaction(InventoryTransaction $transaction) : void{
$transaction->addInventory($this->inventory);
@ -94,10 +78,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Sets the item into the target inventory.
*
* @param Player $source
*
* @return bool
*/
public function execute(Player $source) : bool{
return $this->inventory->setItem($this->inventorySlot, $this->targetItem, false);
@ -105,8 +85,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Sends slot changes to other viewers of the inventory. This will not send any change back to the source Player.
*
* @param Player $source
*/
public function onExecuteSuccess(Player $source) : void{
$viewers = $this->inventory->getViewers();
@ -116,8 +94,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Sends the original slot contents to the source player to revert the action.
*
* @param Player $source
*/
public function onExecuteFail(Player $source) : void{
$this->inventory->sendSlot($this->inventorySlot, $source);