Skip to content

Commit 0b29079

Browse files
committed
Syntactic fixes
1 parent 3c0f200 commit 0b29079

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Enum.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace 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;

0 commit comments

Comments
 (0)