boundedIntAuto(0, self::MAX_AGE, $this->age); } public function getAge() : int{ return $this->age; } /** * @return $this */ public function setAge(int $age) : self{ if($age < 0 || $age > self::MAX_AGE){ throw new \InvalidArgumentException("Age must be in range 0 ... " . self::MAX_AGE); } $this->age = $age; return $this; } }