Skip to content

Commit

Permalink
Merge pull request #31 from spaceemotion/add-aggregate-root-typehints
Browse files Browse the repository at this point in the history
Provide docblocks to AggregateRoot class
  • Loading branch information
freekmurze authored Oct 31, 2019
2 parents 293aac9 + 6af090e commit ffa017f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/AggregateRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ abstract class AggregateRoot
/** @var array */
private $recordedEvents = [];

/**
* @param string $uuid
* @return static
*/
public static function retrieve(string $uuid): AggregateRoot
{
$aggregateRoot = (new static());
Expand All @@ -22,6 +26,10 @@ public static function retrieve(string $uuid): AggregateRoot
return $aggregateRoot->reconstituteFromEvents();
}

/**
* @param ShouldBeStored $domainEvent
* @return static
*/
public function recordThat(ShouldBeStored $domainEvent): AggregateRoot
{
$this->recordedEvents[] = $domainEvent;
Expand All @@ -31,6 +39,9 @@ public function recordThat(ShouldBeStored $domainEvent): AggregateRoot
return $this;
}

/**
* @return static
*/
public function persist(): AggregateRoot
{
$storedEvents = call_user_func(
Expand Down

0 comments on commit ffa017f

Please sign in to comment.