use enums for order direction, conjunctions and aggregate functions#46
Merged
use enums for order direction, conjunctions and aggregate functions#46
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to use dedicated enum types (Direction, Conjunction, and AggregateFunction) instead of integer constants for representing order direction, logical conjunctions, and aggregate functions respectively. This improves type safety and code clarity.
Changes:
- Introduced three new enums:
Direction,Conjunction, andAggregateFunction - Updated all references throughout the codebase to use the new enum types
- Maintained backward compatibility by preserving deprecated constants that reference the new enums
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Query/Direction.php | New enum defining ASCENDING and DESCENDING cases |
| src/Query/Conjunction.php | New enum defining AND and OR cases |
| src/Query/AggregateFunction.php | New enum defining COUNT, SUM, AVERAGE, MIN, and MAX cases |
| src/Query/OrderField.php | Updated to use Direction enum instead of int constants |
| src/Query/WhereGroup.php | Updated to use Conjunction enum instead of int constants |
| src/Query/SelectField.php | Updated to use AggregateFunction enum and improved method return types |
| src/Query/Query.php | Updated orderBy method to handle Direction enum |
| src/Query/Generator/SQL.php | Refactored to use match expressions with new enums |
| src/Query/CountField.php | Updated function property to use AggregateFunction enum |
| src/Query/SumField.php | Updated function property to use AggregateFunction enum |
| src/Query/MinField.php | Updated function property to use AggregateFunction enum |
| src/Query/MaxField.php | Updated function property to use AggregateFunction enum |
| src/Query/AverageField.php | Updated function property to use AggregateFunction enum |
| src/GenericModel.php | Updated to use Conjunction enum |
| src/Driver/Test/TestTable.php | Updated to use Direction enum |
| src/Driver/Test/TestTableEntry.php | Updated to use Conjunction enum |
| src/Driver/Test/TestTableEntryGroup.php | Updated to use AggregateFunction enum |
| test/tests/TestDriverTest.php | Updated test cases to use new enums |
| test/tests/SQLTest.php | Updated test cases to use new enums |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JulianVennen
approved these changes
Feb 3, 2026
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 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.
pavog
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.