month < 1 || $this->month > 12) { throw new \InvalidArgumentException('Month must be between 1 and 12'); } if ($this->day < 1 || $this->day > 31) { throw new \InvalidArgumentException('Day must be between 1 and 31'); } } public function __toString(): string { return $this->year . '-' . $this->month . '-' . $this->day; } }