From 23c88b7dad3900ceb356a927f0fdfb8633fd693c Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 23 Oct 2019 16:14:27 -0400 Subject: [PATCH] Simplify getting 'enum' constants --- src/Editor.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Editor.php b/src/Editor.php index e517814..5a63675 100644 --- a/src/Editor.php +++ b/src/Editor.php @@ -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(); } }