mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
EnumTrait: rename getEnumName() -> name()
this is more concise and brings it more in line with Java.
This commit is contained in:
parent
c45c1c930e
commit
fe98b6c765
@ -158,7 +158,7 @@ class CrashDump{
|
|||||||
"depends" => $d->getDepend(),
|
"depends" => $d->getDepend(),
|
||||||
"softDepends" => $d->getSoftDepend(),
|
"softDepends" => $d->getSoftDepend(),
|
||||||
"main" => $d->getMain(),
|
"main" => $d->getMain(),
|
||||||
"load" => strtoupper($d->getOrder()->getEnumName()),
|
"load" => strtoupper($d->getOrder()->name()),
|
||||||
"website" => $d->getWebsite()
|
"website" => $d->getWebsite()
|
||||||
];
|
];
|
||||||
$this->addLine($d->getName() . " " . $d->getVersion() . " by " . implode(", ", $d->getAuthors()) . " for API(s) " . implode(", ", $d->getCompatibleApis()));
|
$this->addLine($d->getName() . " " . $d->getVersion() . " by " . implode(", ", $d->getAuthors()) . " for API(s) " . implode(", ", $d->getCompatibleApis()));
|
||||||
|
@ -42,11 +42,11 @@ trait EnumTrait{
|
|||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected static function register(self $member) : void{
|
protected static function register(self $member) : void{
|
||||||
$name = strtoupper($member->getEnumName());
|
$name = strtoupper($member->name());
|
||||||
if(isset(self::$members[$name])){
|
if(isset(self::$members[$name])){
|
||||||
throw new \InvalidArgumentException("Enum member name \"$name\" is already reserved");
|
throw new \InvalidArgumentException("Enum member name \"$name\" is already reserved");
|
||||||
}
|
}
|
||||||
self::$members[strtoupper($member->getEnumName())] = $member;
|
self::$members[strtoupper($member->name())] = $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,7 +171,7 @@ public static function %1$s() : self{
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEnumName() : string{
|
public function name() : string{
|
||||||
return $this->enumName;
|
return $this->enumName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user