From 7c7977b846896ccac41b617cb6bd350f15324bd0 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 25 Jul 2017 17:29:51 +0200 Subject: [PATCH] Made exceptions more specific --- Datatypes/Enum.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Datatypes/Enum.php b/Datatypes/Enum.php index af47943df..6ca1c31c5 100644 --- a/Datatypes/Enum.php +++ b/Datatypes/Enum.php @@ -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)