@@ -41,7 +41,7 @@ abstract class Enum implements \JsonSerializable
4141 public function __construct ($ value )
4242 {
4343 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 ());
4545 }
4646
4747 $ this ->value = $ value ;
@@ -82,7 +82,7 @@ public function __toString()
8282 */
8383 final public function equals (Enum $ enum = null )
8484 {
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 );
8686 }
8787
8888 /**
@@ -92,7 +92,7 @@ final public function equals(Enum $enum = null)
9292 */
9393 public static function keys ()
9494 {
95- return array_keys (static ::toArray ());
95+ return \ array_keys (static ::toArray ());
9696 }
9797
9898 /**
@@ -118,8 +118,8 @@ public static function values()
118118 */
119119 public static function toArray ()
120120 {
121- $ class = get_called_class ();
122- if (!array_key_exists ( $ class , static ::$ cache )) {
121+ $ class = \ get_called_class ();
122+ if (!isset ( static ::$ cache[ $ class ] )) {
123123 $ reflection = new \ReflectionClass ($ class );
124124 static ::$ cache [$ class ] = $ reflection ->getConstants ();
125125 }
@@ -136,7 +136,7 @@ public static function toArray()
136136 */
137137 public static function isValid ($ value )
138138 {
139- return in_array ($ value , static ::toArray (), true );
139+ return \ in_array ($ value , static ::toArray (), true );
140140 }
141141
142142 /**
@@ -162,7 +162,7 @@ public static function isValidKey($key)
162162 */
163163 public static function search ($ value )
164164 {
165- return array_search ($ value , static ::toArray (), true );
165+ return \ array_search ($ value , static ::toArray (), true );
166166 }
167167
168168 /**
@@ -181,7 +181,7 @@ public static function __callStatic($name, $arguments)
181181 return new static ($ array [$ name ]);
182182 }
183183
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 ());
185185 }
186186
187187 /**
0 commit comments