enumClass; try { new $className($object->$attribute, $this->useStrictMode); } catch (InvalidValueException $e) { $this->addError($object, $attribute, $e->getMessage()); } catch (\UnexpectedValueException $e) { $this->addError($object, $attribute, $e->getMessage()); } } }