Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

PHPLIB-1367 Add enum for System variables #64

Closed
wants to merge 1 commit into from

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Feb 2, 2024

Fix PHPLIB-1367

Includes #63 (to be merged before)

I originally created factories for system variables, but we can also use enums. I'm not sure what's the best approach. They are almost the same for DX

Copy link
Member Author

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

I'm still not convinced this approach is better than the factory methods.

* CURRENT is modifiable. However, since $<field> is equivalent to $$CURRENT.<field>, rebinding
* CURRENT changes the meaning of $ accesses.
*/
public static function current(string $fieldPath = ''): ResolvesToAny
Copy link
Member Author

@GromNaN GromNaN Feb 16, 2024

Choose a reason for hiding this comment

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

This helper was more explicit than the new Variable::Current->dot(...) function in introduced to the enum.

@@ -38,7 +39,7 @@ public function testRemoveFieldsThatContainPeriods(): void
Stage::replaceWith(
Expression::unsetField(
field: 'price.usd',
input: Expression::variable('ROOT'),
input: Variable::Root,
Copy link
Member Author

Choose a reason for hiding this comment

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

This could have been Variable::root(), which is as good as the enum Variable::Root.

@GromNaN
Copy link
Member Author

GromNaN commented Feb 16, 2024

Closing for now. Lets revisit later. Ticket still open.

@GromNaN GromNaN closed this Feb 16, 2024
@GromNaN GromNaN deleted the PHPLIB-1367 branch February 16, 2024 13:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants