PHP8: use match function

This commit is contained in:
Sunch 2024-08-17 20:12:37 +08:00
parent 1275a4558c
commit f74e6e0638
41 changed files with 300 additions and 574 deletions

View file

@ -16,20 +16,14 @@ abstract class ItemHoe extends ItemTool
}
public function getLevel(){
switch($this->id){
case WOODEN_HOE:
return 1;
case GOLDEN_HOE:
return 2;
case STONE_HOE:
return 3;
case IRON_HOE:
return 4;
case DIAMOND_HOE:
return 5;
default:
return false;
}
return match ($this->id) {
WOODEN_HOE => 1,
GOLDEN_HOE => 2,
STONE_HOE => 3,
IRON_HOE => 4,
DIAMOND_HOE => 5,
default => false,
};
}
}