From 6af090e482588dc9fc41b67cc0c1a653755e4c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gr=C3=A4=C3=9Fel?= Date: Thu, 31 Oct 2019 17:53:28 +0100 Subject: [PATCH] Provide docblocks to AggregateRoot class This fixes the "method not found" errors in IDEs and static analysis tools like phpstan. --- src/AggregateRoot.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/AggregateRoot.php b/src/AggregateRoot.php index 73ebd171..69b0efe0 100644 --- a/src/AggregateRoot.php +++ b/src/AggregateRoot.php @@ -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()); @@ -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; @@ -31,6 +39,9 @@ public function recordThat(ShouldBeStored $domainEvent): AggregateRoot return $this; } + /** + * @return static + */ public function persist(): AggregateRoot { $storedEvents = call_user_func(