refactor(ScheduleStyle): Convert ScheduleStyle to an enum#1017
refactor(ScheduleStyle): Convert ScheduleStyle to an enum#1017JohnVillalovos wants to merge 1 commit intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors ScheduleStyle from a class with public constants to a PHP backed enum (int). This change improves type safety by allowing ScheduleStyle to be used as a proper type hint throughout the codebase instead of being represented as generic integers.
Changes:
- Converted
ScheduleStylefrom a class with constants to a backed enum with integer values - Updated all method signatures to accept and return
ScheduleStyleenum types where appropriate - Modified array key references and template usages to access the integer value via
->valueproperty - Enhanced type safety in
Scheduledomain model by properly typing the internal$_defaultStyleproperty and improving theSetDefaultStyle()method to handle both int and enum inputs
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Domain/Schedule.php | Converted ScheduleStyle class to enum, updated Schedule property type and accessor methods to work with enum |
| Pages/SchedulePage.php | Updated interface and implementation to use ScheduleStyle enum in method signatures, modified array keys to use ->value |
| Pages/ViewSchedulePage.php | Updated array keys to use ->value property of enum cases |
| Pages/ScheduleViewerViewSchedulesPage.php | Updated StyleNames array to use enum ->value for keys |
| Pages/Admin/ManageSchedulesPage.php | Updated StyleNames array to use enum ->value for keys |
| Presenters/Schedule/SchedulePageBuilder.php | Updated to convert between int values from database and ScheduleStyle enum instances |
| WebServices/SchedulesWebService.php | Updated method signatures to match interface changes with ScheduleStyle enum types |
| tpl/Schedule/schedule.tpl | Updated template to use ->value property when accessing enum integer values for HTML attributes |
| tests/Domain/Schedule/ScheduleRepositoryTest.php | Updated test to pass integer value when testing SetDefaultStyle |
| tests/fakes/FakeSchedules.php | Updated fake data to use ->value when providing integer for database row |
| tests/Presenters/SchedulePresenterTest.php | Updated mock interface methods to match new ScheduleStyle enum signatures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ced55fb to
7e05ae0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is done so that it will work better with types in the future. Previously it would have to be typed as an int. Now we can type as ScheduleStyle in many places. Not all as sometimes do need to pass the int value.
7e05ae0 to
0338d2b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is done so that it will work better with types in the future. Previously it would have to be typed as an int. Now we can type as ScheduleStyle in many places. Not all as sometimes do need to pass the int value.