@@ -41,7 +41,7 @@ abstract class Enum implements \JsonSerializable
41
41
public function __construct ($ value )
42
42
{
43
43
if (!$ this ->isValid ($ value )) {
44
- throw new \UnexpectedValueException ("Value ' $ value' is not part of the enum " . get_called_class ());
44
+ throw new \UnexpectedValueException ("Value ' $ value' is not part of the enum " . \ get_called_class ());
45
45
}
46
46
47
47
$ this ->value = $ value ;
@@ -82,7 +82,7 @@ public function __toString()
82
82
*/
83
83
final public function equals (Enum $ enum = null )
84
84
{
85
- return $ enum !== null && $ this ->getValue () === $ enum ->getValue () && get_called_class () == get_class ($ enum );
85
+ return $ enum !== null && $ this ->getValue () === $ enum ->getValue () && \ get_called_class () === \ get_class ($ enum );
86
86
}
87
87
88
88
/**
@@ -92,7 +92,7 @@ final public function equals(Enum $enum = null)
92
92
*/
93
93
public static function keys ()
94
94
{
95
- return array_keys (static ::toArray ());
95
+ return \ array_keys (static ::toArray ());
96
96
}
97
97
98
98
/**
@@ -118,8 +118,8 @@ public static function values()
118
118
*/
119
119
public static function toArray ()
120
120
{
121
- $ class = get_called_class ();
122
- if (!array_key_exists ( $ class , static ::$ cache )) {
121
+ $ class = \ get_called_class ();
122
+ if (!isset ( static ::$ cache[ $ class ] )) {
123
123
$ reflection = new \ReflectionClass ($ class );
124
124
static ::$ cache [$ class ] = $ reflection ->getConstants ();
125
125
}
@@ -136,7 +136,7 @@ public static function toArray()
136
136
*/
137
137
public static function isValid ($ value )
138
138
{
139
- return in_array ($ value , static ::toArray (), true );
139
+ return \ in_array ($ value , static ::toArray (), true );
140
140
}
141
141
142
142
/**
@@ -162,7 +162,7 @@ public static function isValidKey($key)
162
162
*/
163
163
public static function search ($ value )
164
164
{
165
- return array_search ($ value , static ::toArray (), true );
165
+ return \ array_search ($ value , static ::toArray (), true );
166
166
}
167
167
168
168
/**
@@ -181,7 +181,7 @@ public static function __callStatic($name, $arguments)
181
181
return new static ($ array [$ name ]);
182
182
}
183
183
184
- throw new \BadMethodCallException ("No static method or enum constant ' $ name' in class " . get_called_class ());
184
+ throw new \BadMethodCallException ("No static method or enum constant ' $ name' in class " . \ get_called_class ());
185
185
}
186
186
187
187
/**
0 commit comments