/** * @param string $id */ protected function __construct($id) { if (!is_string($id)) { throw new InvalidArgumentException('Id must be a string'); } parent::__construct($id); }
/** * @param int $id */ protected function __construct($id) { if (!is_int($id)) { throw new InvalidArgumentException('Id must be an integer'); } parent::__construct($id); }
/** * @param string $id */ protected function __construct($id) { if (!preg_match('/^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$/i', $id)) { throw new InvalidArgumentException('Id must be an UUID'); } parent::__construct($id); }