now = $now->setTimezone( new DateTimeZone( 'UTC' ) ); } /** * Current instant in UTC. * * {@inheritDoc} * * @since 0.1.0 */ public function now(): DateTimeImmutable { return $this->now; } /** * Move the frozen clock forward (or backward with a negative modifier). * * @param string $modifier DateInterval-compatible relative string, e.g. '+1 hour'. * * @since 0.1.0 */ public function advance( string $modifier ): void { $this->now = $this->now->modify( $modifier )->setTimezone( new DateTimeZone( 'UTC' ) ); } /** * Replace the frozen instant. * * @param DateTimeImmutable $now New instant. * * @since 0.1.0 */ public function set( DateTimeImmutable $now ): void { $this->now = $now->setTimezone( new DateTimeZone( 'UTC' ) ); } }