Convert MessageStatus to a class

Appwrite is using PHP 8 which doesn't support backed enums.
This commit is contained in:
Steven Nguyen 2024-01-09 15:36:58 -08:00
parent af019369e9
commit 34af90b65e
No known key found for this signature in database

View file

@ -2,26 +2,51 @@
namespace Appwrite\Enum; 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 * Message that is not ready to be sent
*/ */
case Draft = 'draft'; public const DRAFT = 'draft';
/** /**
* Scheduled to be sent for a later time * Scheduled to be sent for a later time
*/ */
case Scheduled = 'scheduled'; public const SCHEDULED = 'scheduled';
/** /**
* Picked up by the worker and starting to send * Picked up by the worker and starting to send
*/ */
case Processing = 'processing'; public const PROCESSING = 'processing';
/** /**
* Sent without errors * Sent without errors
*/ */
case Sent = 'sent'; public const SENT = 'sent';
/** /**
* Sent with some errors * Sent with some errors
*/ */
case Failed = 'failed'; public const FAILED = 'failed';
} }