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

        Field\Year::check($year);

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

        Field\Year::check($year);

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

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

@param int $year

@return LocalDate

@throws DateTimeException If the year is outside the valid range.
Returns a copy of this LocalDate with the year altered .