File tree 4 files changed +26
-2
lines changed
4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
### Changed
11
11
12
12
- Require composer/class-map-generator over composer/composer [ 268] ( https://github.com/BenSampo/laravel-enum/pull/268 )
13
+ - Use native types whenever possible
14
+ - Throw when calling ` Enum::getDescription() ` with invalid values
15
+ - Expect class-string in ` InvalidEnumMemberException ` constructor
16
+
17
+ ### Fixed
18
+
19
+ - Leverage late static binding for instantiation methods in PHPStan extension
13
20
14
21
## [ 5.3.1] ( https://github.com/BenSampo/laravel-enum/compare/v5.3.0...v5.3.1 ) - 2022-06-22
15
22
File renamed without changes.
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ Created by [Ben Sampson](https://sampo.co.uk)
49
49
50
50
## Documentation for older versions
51
51
52
- You are reading the documentation for ` 5 .x` .
52
+ You are reading the documentation for ` 6 .x` .
53
53
54
54
- If you're using ** Laravel 8** please see the [ docs for ` 4.x ` ] ( https://github.com/BenSampo/laravel-enum/blob/v4.2.0/README.md ) .
55
55
- If you're using ** Laravel 7** please see the [ docs for ` 2.x ` ] ( https://github.com/BenSampo/laravel-enum/blob/v2.2.0/README.md ) .
@@ -109,7 +109,7 @@ final class UserType extends Enum
109
109
```
110
110
111
111
That's it! Note that because the enum values are defined as plain constants,
112
- you can simple access them like any other class constant.
112
+ you can simply access them like any other class constant.
113
113
114
114
``` php
115
115
UserType::Administrator // Has a value of 0
Original file line number Diff line number Diff line change 1
1
# Upgrade Guide
2
2
3
+ ## 6.x
4
+
5
+ ### Native types
6
+
7
+ The library now uses native types whenever possible.
8
+ When you override methods or implement interfaces, you will need to add them.
9
+
10
+ ### ` Enum::getDescription() ` throws
11
+
12
+ Instead of returning an empty string ` '' ` on invalid values,
13
+ ` Enum::getDescription() ` will throw an ` InvalidEnumMemberException ` .
14
+
15
+ ### Construct ` InvalidEnumMemberException `
16
+
17
+ The constructor of ` InvalidEnumMemberException ` now expects the class name
18
+ of an enum instead of an enum instance.
19
+
3
20
## 5.x
4
21
5
22
### Laravel 9 required
You can’t perform that action at this time.
0 commit comments