You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want your IDE to autocomplete the static instantiation helpers, you can
145
165
generate PHPDoc annotations through an artisan command.
146
166
147
-
By default all Enums in `app/Enums` will be annotated (you can change the folder by passing a path to `--folder`)
167
+
By default, all Enums in `app/Enums` will be annotated (you can change the folder by passing a path to `--folder`).
148
168
149
-
```bash
169
+
```sh
150
170
php artisan enum:annotate
151
171
```
152
172
153
-
You can annotate a single class by specifying the class name
173
+
You can annotate a single class by specifying the class name.
154
174
155
-
```bash
175
+
```sh
156
176
php artisan enum:annotate "App\Enums\UserType"
157
177
```
158
178
@@ -768,7 +788,9 @@ final class UserType extends Enum implements LocalizedEnum
768
788
769
789
The `getDescription` method will now look for the value in your localization files. If a value doesn't exist for a given key, the default description is returned instead.
770
790
771
-
## Customizing enum class description
791
+
## Customizing descriptions
792
+
793
+
### Customizing class description
772
794
773
795
If you'd like to return a custom description for your enum class, add a `Description` attribute to your Enum class:
774
796
@@ -787,7 +809,7 @@ Calling `UserType::getClassDescription()` now returns `List of available User ty
787
809
788
810
You may also override the `getClassDescription` method on the base Enum class if you wish to have more control of the description.
789
811
790
-
## Customizing value descriptions
812
+
###Customizing value descriptions
791
813
792
814
If you'd like to return a custom description for your enum values, add a `Description` attribute to your Enum constants:
793
815
@@ -828,7 +850,7 @@ It's best to register the macro inside a service providers' boot method.
828
850
829
851
Use the [nova-enum-field](https://github.com/simplesquid/nova-enum-field) package by Simple Squid to easily create fields for your Enums in Nova. See their readme for usage.
830
852
831
-
## PHPStan integration
853
+
## PHPStan Integration
832
854
833
855
If you are using [PHPStan](https://github.com/phpstan/phpstan) for static
834
856
analysis, you can enable the extension for proper recognition of the
@@ -855,7 +877,7 @@ Generate DocBlock annotations for enum classes.
855
877
856
878
### `php artisan enum:to-native`
857
879
858
-
Convert a class that extends `BenSampo\Enum\Enum`to a native PHP enum.
880
+
Deprecated, see [migrate to native PHP enums](#migrate-to-native-php-enums).
0 commit comments