Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 3e5721f

Browse files
author
theUniC
committed
Bugfixing
1 parent dc537bb commit 3e5721f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Model/Thread.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)