From 23d952f90df3b7ea8b02196d9bff9894219f8c0b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 2 Nov 2023 19:44:41 +1300 Subject: [PATCH] Force return an empty string when $id, $internalId, or $collection are explicitly set to null to avoid a type error --- src/Database/Document.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Database/Document.php b/src/Database/Document.php index 6311841b4..a4bab306b 100644 --- a/src/Database/Document.php +++ b/src/Database/Document.php @@ -55,7 +55,7 @@ public function __construct(array $input = []) */ public function getId(): string { - return $this->getAttribute('$id', ''); + return $this->getAttribute('$id', '') ?? ''; } /** @@ -63,7 +63,7 @@ public function getId(): string */ public function getInternalId(): string { - return $this->getAttribute('$internalId', ''); + return $this->getAttribute('$internalId', '') ?? ''; } /** @@ -71,7 +71,7 @@ public function getInternalId(): string */ public function getCollection(): string { - return $this->getAttribute('$collection', ''); + return $this->getAttribute('$collection', '') ?? ''; } /**