Simplify getting 'enum' constants
This commit is contained in:
parent
0da8d12758
commit
23c88b7dad
@ -3,6 +3,7 @@
|
||||
namespace Kilo;
|
||||
|
||||
use FFI;
|
||||
use ReflectionClass;
|
||||
|
||||
trait MagicProperties {
|
||||
abstract public function __get(string $name);
|
||||
@ -37,15 +38,7 @@ class Key {
|
||||
|
||||
public static function getConstList(): array
|
||||
{
|
||||
static $self;
|
||||
|
||||
if ($self === NULL)
|
||||
{
|
||||
$class = static::class;
|
||||
$self = new $class;
|
||||
}
|
||||
|
||||
return (new \ReflectionClass($self))->getConstants();
|
||||
return (new ReflectionClass(static::class))->getConstants();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user