@@ -47,53 +47,53 @@ |
||
| 47 | 47 | final public function __construct(string $type) |
| 48 | 48 | { |
| 49 | 49 | if (false === defined("static::$type") || null === constant("static::$type")) { |
| 50 | - throw new InvalidEnumValueException; |
|
| 50 | + throw new InvalidEnumValueException; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $this->value = constant("static::$type"); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Call a static method to construct a new enum |
|
| 58 | - * |
|
| 59 | - * Attempts to convert the called method name to uppercase but if that fails |
|
| 60 | - * then it resorts to using whatever case the method name was passed in. |
|
| 61 | - * |
|
| 62 | - * @param string $name - the name of the method to invoke |
|
| 63 | - * @param array $args - an array of arguments passed to the method call |
|
| 64 | - * @return self |
|
| 65 | - * @throws InvalidEnumValueException - Thrown if the value passed is not an enum constant |
|
| 66 | - */ |
|
| 67 | - final public static function __callStatic(string $method, array $args = []): self |
|
| 68 | - { |
|
| 69 | - try { |
|
| 70 | - return new static(strtoupper($method)); |
|
| 71 | - } catch (InvalidEnumValueException $exception) { |
|
| 72 | - return new static($method); |
|
| 73 | - } |
|
| 74 | - } |
|
| 56 | + /** |
|
| 57 | + * Call a static method to construct a new enum |
|
| 58 | + * |
|
| 59 | + * Attempts to convert the called method name to uppercase but if that fails |
|
| 60 | + * then it resorts to using whatever case the method name was passed in. |
|
| 61 | + * |
|
| 62 | + * @param string $name - the name of the method to invoke |
|
| 63 | + * @param array $args - an array of arguments passed to the method call |
|
| 64 | + * @return self |
|
| 65 | + * @throws InvalidEnumValueException - Thrown if the value passed is not an enum constant |
|
| 66 | + */ |
|
| 67 | + final public static function __callStatic(string $method, array $args = []): self |
|
| 68 | + { |
|
| 69 | + try { |
|
| 70 | + return new static(strtoupper($method)); |
|
| 71 | + } catch (InvalidEnumValueException $exception) { |
|
| 72 | + return new static($method); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Returns the value of the ENUM |
|
| 78 | - * |
|
| 79 | - * @final |
|
| 80 | - * @return mixed |
|
| 81 | - */ |
|
| 82 | - final public function getValue() |
|
| 83 | - { |
|
| 84 | - return $this->value; |
|
| 85 | - } |
|
| 76 | + /** |
|
| 77 | + * Returns the value of the ENUM |
|
| 78 | + * |
|
| 79 | + * @final |
|
| 80 | + * @return mixed |
|
| 81 | + */ |
|
| 82 | + final public function getValue() |
|
| 83 | + { |
|
| 84 | + return $this->value; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Returns the type of the ENUM |
|
| 89 | - * |
|
| 90 | - * @see simondeeley\Type\Type |
|
| 91 | - * @static |
|
| 92 | - * |
|
| 93 | - * @return string - String literal of the enum object |
|
| 94 | - */ |
|
| 95 | - public static function getType(): string |
|
| 96 | - { |
|
| 97 | - return 'ENUM'; |
|
| 98 | - } |
|
| 87 | + /** |
|
| 88 | + * Returns the type of the ENUM |
|
| 89 | + * |
|
| 90 | + * @see simondeeley\Type\Type |
|
| 91 | + * @static |
|
| 92 | + * |
|
| 93 | + * @return string - String literal of the enum object |
|
| 94 | + */ |
|
| 95 | + public static function getType(): string |
|
| 96 | + { |
|
| 97 | + return 'ENUM'; |
|
| 98 | + } |
|
| 99 | 99 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Enum package. |
| 5 | 5 | * For the full copyright information please view the LICENCE file that was |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @return self |
| 65 | 65 | * @throws InvalidEnumValueException - Thrown if the value passed is not an enum constant |
| 66 | 66 | */ |
| 67 | - final public static function __callStatic(string $method, array $args = []): self |
|
| 67 | + final public static function __callStatic(string $method, array $args = [ ]): self |
|
| 68 | 68 | { |
| 69 | 69 | try { |
| 70 | 70 | return new static(strtoupper($method)); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Enum package. |
| 5 | 5 | * For the full copyright information please view the LICENCE file that was |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Enum package. |
| 5 | 5 | * For the full copyright information please view the LICENCE file that was |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Enum package. |
| 5 | 5 | * For the full copyright information please view the LICENCE file that was |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Enum package. |
| 5 | 5 | * For the full copyright information please view the LICENCE file that was |