Skip to content

Commit

Permalink
Document migration better
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Aug 3, 2023
1 parent 85db3d4 commit 255a509
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ You can migrate your usages of `BenSampo\Enum\Enum` to native PHP enums using th
Make sure you meet the following requirements:
- PHP 8.1 or higher
- Laravel 10 or higher
- Rector 0.17 or higher, your `rector.php` includes all relevant files
- Latest version of this library

Depending on the size of your project, you may choose to migrate all enums at once,
or migrate just a couple or one enum at a time.
- Convert all enums at once: `php artisan enum:to-native`
- Pass the fully qualified class name of an enum to limit the conversion: `php artisan enum:to-native "\App\Enums\UserType"`

This is necessary if any enums are used during the bootstrap phase of Laravel,
the conversion of their usages interferes with Larastan and prevents a second run of Rector from working.

Review and validate the code changes for missed edge cases:
- See [Unimplemented](tests/Rector/Unimplemented)
- `Enum::coerce()`: If only values were passed, you can replace it with `tryFrom()`.
Expand Down

0 comments on commit 255a509

Please sign in to comment.