From fff1d448780dfc7068289089be33a966bd9c699c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 27 Apr 2023 23:00:48 -0400 Subject: [PATCH] Account for null value in Entity\Notify->msg - Update possible types of entity properties --- src/Navigation/Notifications/Entity/Notify.php | 10 +++++----- .../Notifications/Factory/FormattedNotify.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Navigation/Notifications/Entity/Notify.php b/src/Navigation/Notifications/Entity/Notify.php index 8de40910b6..b7a007a2f0 100644 --- a/src/Navigation/Notifications/Entity/Notify.php +++ b/src/Navigation/Notifications/Entity/Notify.php @@ -61,15 +61,15 @@ class Notify extends BaseEntity protected $photo; /** @var DateTime */ protected $date; - /** @var string */ + /** @var string|null */ protected $msg; /** @var int */ protected $uid; /** @var UriInterface */ protected $link; - /** @var int */ + /** @var int|null */ protected $itemId; - /** @var int */ + /** @var int|null */ protected $parent; /** @var bool */ protected $seen; @@ -79,13 +79,13 @@ class Notify extends BaseEntity protected $otype; /** @var string */ protected $name_cache; - /** @var string */ + /** @var string|null */ protected $msg_cache; /** @var int|null */ protected $uriId; /** @var int|null */ protected $parentUriId; - /** @var int */ + /** @var int|null */ protected $id; public function __construct(int $type, string $name, UriInterface $url, UriInterface $photo, DateTime $date, int $uid, UriInterface $link, bool $seen, string $verb, string $otype, string $name_cache, string $msg = null, string $msg_cache = null, int $itemId = null, int $uriId = null, int $parent = null, ?int $parentUriId = null, ?int $id = null) diff --git a/src/Navigation/Notifications/Factory/FormattedNotify.php b/src/Navigation/Notifications/Factory/FormattedNotify.php index b34aa74eb9..33abf63e48 100644 --- a/src/Navigation/Notifications/Factory/FormattedNotify.php +++ b/src/Navigation/Notifications/Factory/FormattedNotify.php @@ -222,7 +222,7 @@ class FormattedNotify extends BaseFactory $this->baseUrl . '/notify/' . $Notify->id, Contact::getAvatarUrlForUrl($Notify->url, $Notify->uid, Proxy::SIZE_MICRO), $Notify->url, - strip_tags(BBCode::toPlaintext($Notify->msg)), + strip_tags(BBCode::toPlaintext($Notify->msg ?? '')), DateTimeFormat::local($Notify->date->format(DateTimeFormat::MYSQL), 'r'), Temporal::getRelativeDate($Notify->date->format(DateTimeFormat::MYSQL)), $Notify->seen -- 2.39.5