Skip to content

Commit

Permalink
Fixed a bug in Enum::getAll().
Browse files Browse the repository at this point in the history
  • Loading branch information
Marty Wallace committed Jul 13, 2016
1 parent c0c3f34 commit b80b3b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "martywallace/tempest",
"version": "2.2.0",
"version": "2.2.1",
"description": "A tiny PHP framework.",
"homepage": "https://github.com/MartyWallace/Tempest",
"type": "library",
Expand Down
12 changes: 6 additions & 6 deletions src/Tempest/Utils/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
abstract class Enum {

/** @var string[] */
private static $_reflection;
private static $_reflections = array();

/**
* Get all the constants defined by this enum.
*
* @return array
*/
public static function getAll() {
return self::_reflect()->getConstants();
return static::_reflect()->getConstants();
}

/**
* @return ReflectionClass
*/
private static function _reflect() {
if (empty(self::$_reflection)) {
self::$_reflection = new ReflectionClass(static::class);
protected static function _reflect() {
if (!array_key_exists(static::class, self::$_reflections)) {
self::$_reflections[static::class] = new ReflectionClass(static::class);
}

return self::$_reflection;
return self::$_reflections[static::class];
}

}

0 comments on commit b80b3b6

Please sign in to comment.