public function __construct($value) { if (!$this->isValid($value)) { throw new \UnexpectedValueException("Value '{$value}' is not part of the enum " . get_called_class()); } $this->value = $value; }
public function __construct($value) { try { parent::__construct($value); } catch (\UnexpectedValueException $e) { throw new InvalidArgumentException($value, $e); } }