This repository was archived by the owner on Jun 29, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ abstract class Thread implements ThreadInterface
1919 protected ?int $ id = null ;
2020 protected ?string $ subject = null ;
2121 protected bool $ isSpam = false ;
22- protected Collection | array $ messages ;
23- protected Collection | array $ metadata ;
24- protected Collection | array $ participants ;
22+ protected Collection | array | null $ messages = null ;
23+ protected Collection | array | null $ metadata = null ;
24+ protected Collection | array | null $ participants = null ;
2525 protected ?DateTimeInterface $ createdAt = null ;
2626 protected ?ParticipantInterface $ createdBy = null ;
2727
@@ -84,7 +84,7 @@ public function addMessage(MessageInterface $message): void
8484
8585 public function getMessages (): Collection | array
8686 {
87- return $ this ->messages ;
87+ return $ this ->messages ?? [] ;
8888 }
8989
9090 public function getFirstMessage (): ?MessageInterface
@@ -154,7 +154,7 @@ public function addMetadata(ThreadMetadata $meta): void
154154
155155 public function getMetadataForParticipant (ParticipantInterface $ participant ): ?ThreadMetadata
156156 {
157- foreach ($ this ->metadata as $ meta ) {
157+ foreach ($ this ->metadata ?? [] as $ meta ) {
158158 if ($ meta ->getParticipant ()->getId () === $ participant ->getId ()) {
159159 return $ meta ;
160160 }
You can’t perform that action at this time.
0 commit comments