mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +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:
@ -47,13 +47,13 @@ final class GameMode{
|
||||
/** @var self[] */
|
||||
protected static $magicNumberMap = [];
|
||||
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("survival", 0, "Survival", "gameMode.survival", ["s", "0"]),
|
||||
new self("creative", 1, "Creative", "gameMode.creative", ["c", "1"]),
|
||||
new self("adventure", 2, "Adventure", "gameMode.adventure", ["a", "2"]),
|
||||
new self("spectator", 3, "Spectator", "gameMode.spectator", ["v", "view", "3"])
|
||||
];
|
||||
);
|
||||
}
|
||||
|
||||
protected static function register(self $member) : void{
|
||||
|
Reference in New Issue
Block a user