public function setToFirstDayOfMonth(int $month = null) : Time
    {
        if ($this->frozen) {
            throw new \RuntimeException(get_class($this) . ' is read-only, frozen.');
        }
        if ($month !== null) {
            if ($month < 1 || $month > 12) {
                throw new \InvalidArgumentException('Arg month[' . $month . '] isn\'t null or 1 through 12.');
            }
            $mnth = $month;
        }
        else {
            $mnth = (int) $this->format('m');
        }
        return $this->setDate(
            (int) $this->format('Y'),
            $mnth,
            1
        );
    }
public function setToFirstDayOfMonth(int $month = null) : Time
    {
        if ($this->frozen) {
            throw new \RuntimeException(get_class($this) . ' is read-only, frozen.');
        }
        if ($month !== null) {
            if ($month < 1 || $month > 12) {
                throw new \InvalidArgumentException('Arg month[' . $month . '] isn\'t null or 1 through 12.');
            }
            $mnth = $month;
        }
        else {
            $mnth = (int) $this->format('m');
        }
        return $this->setDate(
            (int) $this->format('Y'),
            $mnth,
            1
        );
    }
public function setToFirstDayOfMonth ( int $ month = null ) : Time { if ( $ this -> frozen ) { throw new \ RuntimeException ( get_class ( $ this ) . ' is read-only, frozen.' ) ; } if ( $ month !== null ) { if ( $ month < 1 || $ month > 12 ) { throw new \ InvalidArgumentException ( 'Arg month[' . $ month . '] isn\'t null or 1 through 12.' ) ; } $ mnth = $ month ; } else { $ mnth = ( int ) $ this -> format ( 'm' ) ; } return $ this -> setDate ( ( int ) $ this -> format ( 'Y' ) , $ mnth , 1 ) ; }
Set to first day of a month.

@param int|null $month
Null: month of this object.

@return Time

@throws \RuntimeException
Frozen.
@throws \InvalidArgumentException
Arg month not null or 1 through 12.
Set to first day of a month .