src/MonthDay.php
public function withDay(int $day) : MonthDay
    {
        if ($day === $this->day) {
            return $this;
        }

        Field\DayOfMonth::check($day, $this->month);

        return new MonthDay($this->month, $day);
    }
public function withDay(int $day) : MonthDay
    {
        if ($day === $this->day) {
            return $this;
        }

        Field\DayOfMonth::check($day, $this->month);

        return new MonthDay($this->month, $day);
    }
public function withDay ( int $ day ) : MonthDay { if ( $ day === $ this -> day ) { return $ this ; } Field \ DayOfMonth :: check ( $ day , $ this -> month ) ; return new MonthDay ( $ this -> month , $ day ) ; }
Returns a copy of this MonthDay with the day-of-month altered.

If the day-of-month is invalid for the month, an exception is thrown.

@param int $day

@return MonthDay

@throws DateTimeException If the day-of-month is invalid for the month.
Returns a copy of this MonthDay with the day - of - month altered .