mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-21 22:08:41 +00:00
Made exceptions more specific
This commit is contained in:
parent
33849c8a1f
commit
7c7977b846
|
|
@ -85,14 +85,14 @@ abstract class Enum
|
|||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception Throws this exception if the constant is not defined in the enum class.
|
||||
* @throws \UnexpectedValueException Throws this exception if the constant is not defined in the enum class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getByName(string $name)
|
||||
{
|
||||
if (!self::isValidName($name)) {
|
||||
throw new \Exception('Undefined constant "' . $name . '"');
|
||||
throw new \UnexpectedValueException($name);
|
||||
}
|
||||
|
||||
return constant('static::' . $name);
|
||||
|
|
@ -105,8 +105,6 @@ abstract class Enum
|
|||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception Throws this exception if the constant is not defined in the enum class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getName(string $value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user