public function setMax(int $max) : self
{
if ($max <= 0) {
throw new \InvalidArgumentException('Length of string must be greater than zero.');
}
if ($this->min !== null && $max < $this->min) {
throw new \InvalidArgumentException('Min length must be lower or equal to max length.');
}
$this->max = $max;
return $this;
}