diff --git a/src/pocketmine/item/enchantment/Enchantment.php b/src/pocketmine/item/enchantment/Enchantment.php index 71416adee..21bf69e5a 100644 --- a/src/pocketmine/item/enchantment/Enchantment.php +++ b/src/pocketmine/item/enchantment/Enchantment.php @@ -93,7 +93,7 @@ class Enchantment{ /** @var Enchantment[] */ protected static $enchantments; - public static function init(){ + public static function init() : void{ self::$enchantments = new \SplFixedArray(256); self::registerEnchantment(new ProtectionEnchantment(self::PROTECTION, "%enchantment.protect.all", self::RARITY_COMMON, self::SLOT_ARMOR, self::SLOT_NONE, 4, 0.75, null)); @@ -137,7 +137,7 @@ class Enchantment{ * * @return Enchantment|null */ - public static function getEnchantment(int $id){ + public static function getEnchantment(int $id) : ?Enchantment{ return self::$enchantments[$id] ?? null; } @@ -146,7 +146,7 @@ class Enchantment{ * * @return Enchantment|null */ - public static function getEnchantmentByName(string $name){ + public static function getEnchantmentByName(string $name) : ?Enchantment{ $const = Enchantment::class . "::" . strtoupper($name); if(defined($const)){ return self::getEnchantment(constant($const)); diff --git a/src/pocketmine/item/enchantment/EnchantmentEntry.php b/src/pocketmine/item/enchantment/EnchantmentEntry.php index b1812859e..286061c20 100644 --- a/src/pocketmine/item/enchantment/EnchantmentEntry.php +++ b/src/pocketmine/item/enchantment/EnchantmentEntry.php @@ -28,29 +28,31 @@ class EnchantmentEntry{ /** @var Enchantment[] */ private $enchantments; + /** @var int */ private $cost; + /** @var string */ private $randomName; /** * @param Enchantment[] $enchantments - * @param number $cost + * @param int $cost * @param string $randomName */ - public function __construct(array $enchantments, $cost, $randomName){ + public function __construct(array $enchantments, int $cost, string $randomName){ $this->enchantments = $enchantments; - $this->cost = (int) $cost; + $this->cost = $cost; $this->randomName = $randomName; } - public function getEnchantments(){ + public function getEnchantments() : array{ return $this->enchantments; } - public function getCost(){ + public function getCost() : int{ return $this->cost; } - public function getRandomName(){ + public function getRandomName() : string{ return $this->randomName; } diff --git a/src/pocketmine/item/enchantment/EnchantmentList.php b/src/pocketmine/item/enchantment/EnchantmentList.php index e89510f3e..c95b97374 100644 --- a/src/pocketmine/item/enchantment/EnchantmentList.php +++ b/src/pocketmine/item/enchantment/EnchantmentList.php @@ -26,30 +26,31 @@ namespace pocketmine\item\enchantment; class EnchantmentList{ - /** @var EnchantmentEntry[] */ + /** @var \SplFixedArray|EnchantmentEntry[] */ private $enchantments; - public function __construct($size){ + public function __construct(int $size){ $this->enchantments = new \SplFixedArray($size); } /** - * @param $slot + * @param int $slot * @param EnchantmentEntry $entry */ - public function setSlot($slot, EnchantmentEntry $entry){ + public function setSlot(int $slot, EnchantmentEntry $entry) : void{ $this->enchantments[$slot] = $entry; } /** - * @param $slot + * @param int $slot + * * @return EnchantmentEntry */ - public function getSlot($slot){ + public function getSlot(int $slot) : EnchantmentEntry{ return $this->enchantments[$slot]; } - public function getSize(){ + public function getSize() : int{ return $this->enchantments->getSize(); }