. * Also compare . * * Domain event objects must be immutable. * * An event object should contain all information that was used to affect that * change (the command parameters) as well as information representing the * outcome of the change. * * @since 1.44 * @unstable until 1.45, should become stable to extend */ abstract class DomainEvent { private string $type; private ConvertibleTimestamp $timestamp; /** * @stable to call * @param string $type * @param string|ConvertibleTimestamp|false $timestamp */ public function __construct( string $type, $timestamp = false ) { $this->type = $type; $this->timestamp = $timestamp instanceof ConvertibleTimestamp ? $timestamp : MWTimestamp::getInstance( $timestamp ); } /** * @return string */ public function getEventType(): string { return $this->type; } /** * @return ConvertibleTimestamp */ public function getEventTimestamp(): string { return $this->timestamp; } }