From 34af90b65e96eb41bafde4e3193846bdce25768d Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 9 Jan 2024 15:36:58 -0800 Subject: [PATCH] Convert MessageStatus to a class Appwrite is using PHP 8 which doesn't support backed enums. --- src/Appwrite/Enum/MessageStatus.php | 37 ++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Appwrite/Enum/MessageStatus.php b/src/Appwrite/Enum/MessageStatus.php index 77ac1a2575..636a5ef4bb 100644 --- a/src/Appwrite/Enum/MessageStatus.php +++ b/src/Appwrite/Enum/MessageStatus.php @@ -2,26 +2,51 @@ namespace Appwrite\Enum; -enum MessageStatus: string +// TODO: Convert to backed enum after upgrading to PHP 8.1 +// enum MessageStatus: string +// { +// /** +// * Message that is not ready to be sent +// */ +// case Draft = 'draft'; +// /** +// * Scheduled to be sent for a later time +// */ +// case Scheduled = 'scheduled'; +// /** +// * Picked up by the worker and starting to send +// */ +// case Processing = 'processing'; +// /** +// * Sent without errors +// */ +// case Sent = 'sent'; +// /** +// * Sent with some errors +// */ +// case Failed = 'failed'; +// } + +class MessageStatus { /** * Message that is not ready to be sent */ - case Draft = 'draft'; + public const DRAFT = 'draft'; /** * Scheduled to be sent for a later time */ - case Scheduled = 'scheduled'; + public const SCHEDULED = 'scheduled'; /** * Picked up by the worker and starting to send */ - case Processing = 'processing'; + public const PROCESSING = 'processing'; /** * Sent without errors */ - case Sent = 'sent'; + public const SENT = 'sent'; /** * Sent with some errors */ - case Failed = 'failed'; + public const FAILED = 'failed'; }