public static function fromAggregateRoot($eventSourcedAggregateRoot): AggregateType
    {
        if (! \is_object($eventSourcedAggregateRoot)) {
            throw new Exception\AggregateTypeException(
                \sprintf('Aggregate root must be an object but type of %s given', \gettype($eventSourcedAggregateRoot))
            );
        }

        if ($eventSourcedAggregateRoot instanceof AggregateTypeProvider) {
            return $eventSourcedAggregateRoot->aggregateType();
        }

        $self = new static();
        $self->aggregateType = \get_class($eventSourcedAggregateRoot);

        return $self;
    }