src/LocalDate.php
public function withMonth(int $month) : LocalDate
    {
        if ($month === $this->month) {
            return $this;
        }

        Field\MonthOfYear::check($month);

        return $this->resolvePreviousValid($this->year, $month, $this->day);
    }
public function withMonth(int $month) : LocalDate
    {
        if ($month === $this->month) {
            return $this;
        }

        Field\MonthOfYear::check($month);

        return $this->resolvePreviousValid($this->year, $month, $this->day);
    }
public function withMonth ( int $ month ) : LocalDate { if ( $ month === $ this -> month ) { return $ this ; } Field \ MonthOfYear :: check ( $ month ) ; return $ this -> resolvePreviousValid ( $ this -> year , $ month , $ this -> day ) ; }
Returns a copy of this LocalDate with the month-of-year altered.

If the day-of-month is invalid for the month and year, it will be changed to the last valid day of the month.

@param int $month

@return LocalDate

@throws DateTimeException If the month is invalid.
Returns a copy of this LocalDate with the month - of - year altered .