More nullable and void typehints

This commit is contained in:
Dylan K. Taylor
2019-03-02 10:29:11 +00:00
parent 1f5c901f29
commit 6c8fa8ae28
108 changed files with 392 additions and 384 deletions

View File

@@ -61,7 +61,7 @@ class PlayerInventory extends BaseInventory{
*
* @throws \InvalidArgumentException
*/
private function throwIfNotHotbarSlot(int $slot){
private function throwIfNotHotbarSlot(int $slot) : void{
if(!$this->isHotbarSlot($slot)){
throw new \InvalidArgumentException("$slot is not a valid hotbar slot index (expected 0 - " . ($this->getHotbarSize() - 1) . ")");
}
@@ -98,7 +98,7 @@ class PlayerInventory extends BaseInventory{
*
* @throws \InvalidArgumentException if the hotbar slot is out of range
*/
public function setHeldItemIndex(int $hotbarSlot, bool $send = true){
public function setHeldItemIndex(int $hotbarSlot, bool $send = true) : void{
$this->throwIfNotHotbarSlot($hotbarSlot);
$this->itemInHandIndex = $hotbarSlot;
@@ -140,7 +140,7 @@ class PlayerInventory extends BaseInventory{
*
* @param Player|Player[] $target
*/
public function sendHeldItem($target){
public function sendHeldItem($target) : void{
$item = $this->getItemInHand();
$pk = new MobEquipmentPacket();
@@ -170,7 +170,7 @@ class PlayerInventory extends BaseInventory{
return 9;
}
public function sendCreativeContents(){
public function sendCreativeContents() : void{
//TODO: this mess shouldn't be in here
$holder = $this->getHolder();
if(!($holder instanceof Player)){