Simplify getting 'enum' constants

This commit is contained in:
Timothy Warren 2019-10-23 16:14:27 -04:00
parent 0da8d12758
commit 23c88b7dad
1 changed files with 2 additions and 9 deletions

View File

@ -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();
}
}