mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 00:25:04 +00:00
Get rid of EnumTrait::fromString()
it's better to just implement this for stuff where there's explicitly designated aliases, otherwise we could end up with unexpected BC breaks (e.g. hardcoding POSTWORLD in plugin.yml would suddenly break if the core enum was changed, even though it remained valid).
This commit is contained in:
@ -56,19 +56,6 @@ trait EnumTrait{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the enum member matching the given name.
|
||||
* This is overridden to change the return typehint.
|
||||
*
|
||||
* @throws \InvalidArgumentException if no member matches.
|
||||
*/
|
||||
public static function fromString(string $name) : self{
|
||||
//phpstan doesn't support generic traits yet :(
|
||||
/** @var self $result */
|
||||
$result = self::_registryFromString($name);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @var int|null */
|
||||
private static $nextId = null;
|
||||
|
||||
|
Reference in New Issue
Block a user