protected function prepareDateTime($value)
    {
        if ($this->requireAppTimeZone && !static::timeZoneEqual($value->getTimeZone(), $this->appTimeZone)) {
            // Actually performing this conversion may not be an issue. Wait
            // until it is raised before making a decision.
            throw new \UnexpectedValueException(
                "Incoming time zone {$value->getTimeZone()->getName()} did not match app time zone {$this->appTimeZone->getName()}"
            );
        }
        $value = clone $value;
        $value = $value->setTimeZone($this->dbTimeZone);
        if ($this->forceTime) {
            $value = $value->setTime(...$this->forceTime);
        }
        return $value;
    }
protected function prepareDateTime($value)
    {
        if ($this->requireAppTimeZone && !static::timeZoneEqual($value->getTimeZone(), $this->appTimeZone)) {
            // Actually performing this conversion may not be an issue. Wait
            // until it is raised before making a decision.
            throw new \UnexpectedValueException(
                "Incoming time zone {$value->getTimeZone()->getName()} did not match app time zone {$this->appTimeZone->getName()}"
            );
        }
        $value = clone $value;
        $value = $value->setTimeZone($this->dbTimeZone);
        if ($this->forceTime) {
            $value = $value->setTime(...$this->forceTime);
        }
        return $value;
    }
protected function prepareDateTime ( $ value ) { if ( $ this -> requireAppTimeZone && ! static :: timeZoneEqual ( $ value -> getTimeZone ( ) , $ this -> appTimeZone ) ) { // Actually performing this conversion may not be an issue. Wait // until it is raised before making a decision. throw new \ UnexpectedValueException ( "Incoming time zone {$value->getTimeZone()->getName()} did not match app time zone {$this->appTimeZone->getName()}" ) ; } $ value = clone $ value ; $ value = $ value -> setTimeZone ( $ this -> dbTimeZone ) ; if ( $ this -> forceTime ) { $ value = $ value -> setTime ( ... $ this -> forceTime ) ; } return $ value ; }
Don't type hint here - there's no common interface between DateTime and DateTimeImmutable
at 5.6 that supports all the methods we are using, though both objects remain largely interchangeable.
Don t type hint here - there s no common interface between DateTime and DateTimeImmutable at 5 . 6 that supports all the methods we are using though both objects remain largely interchangeable .