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

Commit

Permalink
Bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
theUniC committed Apr 4, 2021
1 parent dc537bb commit 3e5721f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Model/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ abstract class Thread implements ThreadInterface
protected ?int $id = null;
protected ?string $subject = null;
protected bool $isSpam = false;
protected Collection | array $messages;
protected Collection | array $metadata;
protected Collection | array $participants;
protected Collection | array | null $messages = null;
protected Collection | array | null $metadata = null;
protected Collection | array | null $participants = null;
protected ?DateTimeInterface $createdAt = null;
protected ?ParticipantInterface $createdBy = null;

Expand Down Expand Up @@ -84,7 +84,7 @@ public function addMessage(MessageInterface $message): void

public function getMessages(): Collection | array
{
return $this->messages;
return $this->messages ?? [];
}

public function getFirstMessage(): ?MessageInterface
Expand Down Expand Up @@ -154,7 +154,7 @@ public function addMetadata(ThreadMetadata $meta): void

public function getMetadataForParticipant(ParticipantInterface $participant): ?ThreadMetadata
{
foreach ($this->metadata as $meta) {
foreach ($this->metadata ?? [] as $meta) {
if ($meta->getParticipant()->getId() === $participant->getId()) {
return $meta;
}
Expand Down

0 comments on commit 3e5721f

Please sign in to comment.