File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 66
77namespace MyCLabs \Enum ;
88
9+ use BadMethodCallException ;
10+ use UnexpectedValueException ;
11+
912/**
1013 * Base Enum class
1114 *
@@ -36,12 +39,12 @@ abstract class Enum
3639 *
3740 * @param mixed $value
3841 *
39- * @throws \ UnexpectedValueException if incompatible type is given.
42+ * @throws UnexpectedValueException if incompatible type is given.
4043 */
4144 public function __construct ($ value )
4245 {
43- if (!$ this -> isValid ($ value )) {
44- throw new \ UnexpectedValueException ("Value ' $ value' is not part of the enum " . get_called_class ());
46+ if (!static :: isValid ($ value )) {
47+ throw new UnexpectedValueException ("Value ' $ value' is not part of the enum " . get_called_class ());
4548 }
4649
4750 $ this ->value = $ value ;
@@ -187,15 +190,15 @@ public static function fromKey($name)
187190 * @param array $arguments
188191 *
189192 * @return static
190- * @throws \ BadMethodCallException
193+ * @throws BadMethodCallException
191194 */
192195 public static function __callStatic ($ name , $ arguments )
193196 {
194197 $ result = static ::fromKey ($ name );
195198
196199 if ($ result === null ) {
197200 $ msg = "No static method or enum constant ' $ name' in class " . get_called_class ();
198- throw new \ BadMethodCallException ($ msg );
201+ throw new BadMethodCallException ($ msg );
199202 }
200203
201204 return $ result ;
You can’t perform that action at this time.
0 commit comments