src/Carbon/CarbonPeriod.php
public function setDateClass(string $dateClass)
    {
        if (!is_a($dateClass, CarbonInterface::class, true)) {
            throw new InvalidArgumentException(sprintf(
                'Given class does not implement %s: %s', CarbonInterface::class, $dateClass
            ));
        }

        $this->dateClass = $dateClass;

        if (is_a($dateClass, Carbon::class, true)) {
            $this->toggleOptions(static::IMMUTABLE, false);
        } elseif (is_a($dateClass, CarbonImmutable::class, true)) {
            $this->toggleOptions(static::IMMUTABLE, true);
        }

        return $this;
    }
public function setDateClass(string $dateClass)
    {
        if (!is_a($dateClass, CarbonInterface::class, true)) {
            throw new InvalidArgumentException(sprintf(
                'Given class does not implement %s: %s', CarbonInterface::class, $dateClass
            ));
        }

        $this->dateClass = $dateClass;

        if (is_a($dateClass, Carbon::class, true)) {
            $this->toggleOptions(static::IMMUTABLE, false);
        } elseif (is_a($dateClass, CarbonImmutable::class, true)) {
            $this->toggleOptions(static::IMMUTABLE, true);
        }

        return $this;
    }
public function setDateClass ( string $ dateClass ) { if ( ! is_a ( $ dateClass , CarbonInterface :: class , true ) ) { throw new InvalidArgumentException ( sprintf ( 'Given class does not implement %s: %s' , CarbonInterface :: class , $ dateClass ) ) ; } $ this -> dateClass = $ dateClass ; if ( is_a ( $ dateClass , Carbon :: class , true ) ) { $ this -> toggleOptions ( static :: IMMUTABLE , false ) ; } elseif ( is_a ( $ dateClass , CarbonImmutable :: class , true ) ) { $ this -> toggleOptions ( static :: IMMUTABLE , true ) ; } return $ this ; }
Set the iteration item class.

@param string $dateClass

@return $this
Set the iteration item class .