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

        Field\MonthOfYear::check($month);

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

        Field\MonthOfYear::check($month);

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

@param int $month

@return YearMonth

@throws DateTimeException If the month-of-year is not valid.
Returns a copy of this YearMonth with the month - of - year altered .