Skip to content

use enums for order direction, conjunctions and aggregate functions#46

Merged
matthi4s merged 2 commits intomasterfrom
query-enums
Feb 4, 2026
Merged

use enums for order direction, conjunctions and aggregate functions#46
matthi4s merged 2 commits intomasterfrom
query-enums

Conversation

@matthi4s
Copy link
Member

@matthi4s matthi4s commented Feb 3, 2026

No description provided.

@matthi4s matthi4s requested review from Copilot and pavog February 3, 2026 17:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and AggregateFunction
  • 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.

@matthi4s matthi4s requested a review from Copilot February 3, 2026 17:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@matthi4s matthi4s merged commit 451cd46 into master Feb 4, 2026
3 checks passed
@matthi4s matthi4s deleted the query-enums branch February 4, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants