src/LocalDate.php
public function plusMonths(int $months) : LocalDate
    {
        $month = $this->month + $months - 1;

        $yearDiff = Math::floorDiv($month, 12);
        $month = Math::floorMod($month, 12) + 1;

        $year = $this->year + $yearDiff;

        return $this->resolvePreviousValid($year, $month, $this->day);
    }
public function plusMonths(int $months) : LocalDate
    {
        $month = $this->month + $months - 1;

        $yearDiff = Math::floorDiv($month, 12);
        $month = Math::floorMod($month, 12) + 1;

        $year = $this->year + $yearDiff;

        return $this->resolvePreviousValid($year, $month, $this->day);
    }
public function plusMonths ( int $ months ) : LocalDate { $ month = $ this -> month + $ months - 1 ; $ yearDiff = Math :: floorDiv ( $ month , 12 ) ; $ month = Math :: floorMod ( $ month , 12 ) + 1 ; $ year = $ this -> year + $ yearDiff ; return $ this -> resolvePreviousValid ( $ year , $ month , $ this -> day ) ; }
Returns a copy of this LocalDate with the specified period in months added.

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

@param int $months

@return LocalDate
Returns a copy of this LocalDate with the specified period in months added .