File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ abstract class Enum
22
22
protected $ value ;
23
23
24
24
/**
25
- * Store instantiated reflection objects in a static cache.
25
+ * Store existing constants in a static cache per object .
26
26
* @var array
27
27
*/
28
- protected static $ reflectionCache = array ();
28
+ private static $ constantsCache = array ();
29
29
30
30
/**
31
31
* Creates a new value of some type
@@ -64,10 +64,11 @@ public function __toString()
64
64
public static function toArray ()
65
65
{
66
66
$ calledClass = get_called_class ();
67
- if (!array_key_exists ($ calledClass , self ::$ reflectionCache )) {
68
- self ::$ reflectionCache [$ calledClass ] = new \ReflectionClass ($ calledClass );
67
+ if (!array_key_exists ($ calledClass , self ::$ constantsCache )) {
68
+ $ reflectin = new \ReflectionClass ($ calledClass );
69
+ self ::$ constantsCache [$ calledClass ] = $ reflection ->getConstants ();
69
70
}
70
- return $ reflection -> getConstants () ;
71
+ return self :: $ constantsCache [ $ calledClass ] ;
71
72
}
72
73
73
74
/**
You can’t perform that action at this time.
0 commit comments