From fc428d533d815178ff494eba85fa28797ca7995e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 12 Jan 2024 23:24:43 +0100 Subject: [PATCH] update stringOptions() examples to match the enums used in the README --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f236d21..d6b57f8 100644 --- a/README.md +++ b/README.md @@ -194,18 +194,20 @@ Role::options(); // ['ADMINISTRATOR', 'SUBSCRIBER', 'GUEST'] The trait also adds the `stringOptions()` method that can be used for generating convenient string representations of your enum options: ```php // First argument is the callback, second argument is glue -// returns "PENDING => 0, DONE => 1" -Status::stringOptions(fn ($name, $value) => "$name => $value", ', '); +// returns "INCOMPLETE => 0, COMPLETED => 1, CANCELED => 2" +TaskStatus::stringOptions(fn ($name, $value) => "$name => $value", ', '); ``` For pure enums (non-backed), the name is used in place of `$value` (meaning that both `$name` and `$value` are the same). Both arguments for this method are optional, the glue defaults to `\n` and the callback defaults to generating HTML ` -// -Status::stringOptions(); // backed enum +// +// +// +TaskStatus::stringOptions(); // backed enum -// +// +// // Role::stringOptions(); // pure enum ```