mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
allow use of any iterable for enum initialization
this allows possible use of generators
This commit is contained in:
parent
44b7239847
commit
a6395c9ac7
@ -57,7 +57,7 @@ final class DyeColor{
|
||||
/** @var DyeColor[] */
|
||||
private static $numericIdMap = [];
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new DyeColor("white", "White", 0, new Color(0xf0, 0xf0, 0xf0)),
|
||||
new DyeColor("orange", "Orange", 1, new Color(0xf9, 0x80, 0x1d)),
|
||||
|
@ -46,7 +46,7 @@ final class SkullType{
|
||||
/** @var SkullType[] */
|
||||
private static $numericIdMap = [];
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new SkullType("skeleton", "Skeleton Skull", 0),
|
||||
new SkullType("wither_skeleton", "Wither Skeleton Skull", 1),
|
||||
|
@ -37,7 +37,7 @@ use pocketmine\utils\EnumTrait;
|
||||
final class SlabType{
|
||||
use EnumTrait;
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new self("bottom"),
|
||||
new self("top"),
|
||||
|
@ -46,7 +46,7 @@ final class TreeType{
|
||||
/** @var TreeType[] */
|
||||
private static $numericIdMap = [];
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new TreeType("oak", "Oak", 0),
|
||||
new TreeType("spruce", "Spruce", 1),
|
||||
|
@ -37,7 +37,7 @@ use pocketmine\utils\EnumTrait;
|
||||
final class ItemUseResult{
|
||||
use EnumTrait;
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new self("none"),
|
||||
new self("fail"),
|
||||
|
@ -47,7 +47,7 @@ final class GameMode{
|
||||
/** @var self[] */
|
||||
protected static $magicNumberMap = [];
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new self("survival", 0, "Survival", "gameMode.survival", ["s", "0"]),
|
||||
new self("creative", 1, "Creative", "gameMode.creative", ["c", "1"]),
|
||||
|
@ -36,7 +36,7 @@ use pocketmine\utils\EnumTrait;
|
||||
final class PluginLoadOrder{
|
||||
use EnumTrait;
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new self("startup"),
|
||||
new self("postworld")
|
||||
|
@ -54,9 +54,9 @@ trait EnumTrait{
|
||||
*
|
||||
* (This ought to be private, but traits suck too much for that.)
|
||||
*
|
||||
* @return self[]
|
||||
* @return self[]|iterable
|
||||
*/
|
||||
abstract protected static function setup() : array;
|
||||
abstract protected static function setup() : iterable;
|
||||
|
||||
/**
|
||||
* @internal Lazy-inits the enum if necessary.
|
||||
|
@ -41,7 +41,7 @@ class NoteInstrument{
|
||||
__construct as Enum___construct;
|
||||
}
|
||||
|
||||
protected static function setup() : array{
|
||||
protected static function setup() : iterable{
|
||||
return [
|
||||
new self("piano", 0),
|
||||
new self("bass_drum", 1),
|
||||
|
Loading…
x
Reference in New Issue
Block a user