Skip to content

Introduce Direction enum for OrderField + Introduce Conjunction enum for WhereGroup#23

Closed
pavog wants to merge 8 commits intomasterfrom
add-types-to-const
Closed

Introduce Direction enum for OrderField + Introduce Conjunction enum for WhereGroup#23
pavog wants to merge 8 commits intomasterfrom
add-types-to-const

Conversation

@pavog
Copy link
Copy Markdown
Member

@pavog pavog commented Aug 6, 2025

No description provided.

@pavog pavog requested a review from matthi4s August 6, 2025 16:39
Comment thread src/Query/OrderField.php Outdated
const ASCENDING = 0;
const DESCENDING = 1;
const int ASCENDING = 0;
const int DESCENDING = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this would be better as an enum. The value doesn't actually mean anything useful.

Comment thread src/Query/WhereGroup.php Outdated
const AND = 0;
const OR = 1;
const int AND = 0;
const int OR = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this would be better as an enum. The value doesn't actually mean anything useful.

@pavog pavog changed the title Add types to constants Introduce Direction enum for OrderField + Introduce Conjunction enum for WhereGroup Aug 7, 2025
@pavog pavog requested a review from JulianVennen August 7, 2025 13:51
Comment thread src/Query/Query.php Outdated
Comment thread src/Query/OrderField.php
* Direction constants
*/
const ASCENDING = 0;
const DESCENDING = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Keeping them and setting them to the enum value is probably better for at least some backwards compatibility. You can also mark them as deprecated via phpdoc.

Comment thread src/Query/WhereGroup.php
* Conjunction values
*/
const AND = 0;
const OR = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Keeping them and setting them to the enum value is probably better for at least some backwards compatibility. You can also mark them as deprecated via phpdoc.

@matthi4s matthi4s closed this Feb 3, 2026
@matthi4s matthi4s deleted the add-types-to-const branch February 3, 2026 17:42
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