mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
EnumTrait: use a better method to initialize enums
this method is simpler, and is also safe at the native type level. Coincidentally, it also eliminates 30 PHPStan false-positives.
This commit is contained in:
@@ -37,11 +37,11 @@ use pocketmine\utils\EnumTrait;
|
||||
final class ItemUseResult{
|
||||
use EnumTrait;
|
||||
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("none"),
|
||||
new self("fail"),
|
||||
new self("success")
|
||||
];
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -41,14 +41,14 @@ final class ToolTier{
|
||||
__construct as Enum___construct;
|
||||
}
|
||||
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("wood", 1, 60, 5, 2),
|
||||
new self("gold", 2, 33, 5, 12),
|
||||
new self("stone", 3, 132, 6, 4),
|
||||
new self("iron", 4, 251, 7, 6),
|
||||
new self("diamond", 5, 1562, 8, 8)
|
||||
];
|
||||
);
|
||||
}
|
||||
|
||||
/** @var int */
|
||||
|
Reference in New Issue
Block a user