Simplify getting 'enum' constants

This commit is contained in:
Timothy Warren 2019-10-23 16:14:27 -04:00
parent 0da8d12758
commit 23c88b7dad

View File

@ -3,6 +3,7 @@
namespace Kilo; namespace Kilo;
use FFI; use FFI;
use ReflectionClass;
trait MagicProperties { trait MagicProperties {
abstract public function __get(string $name); abstract public function __get(string $name);
@ -37,15 +38,7 @@ class Key {
public static function getConstList(): array public static function getConstList(): array
{ {
static $self; return (new ReflectionClass(static::class))->getConstants();
if ($self === NULL)
{
$class = static::class;
$self = new $class;
}
return (new \ReflectionClass($self))->getConstants();
} }
} }