-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPLIB-1598 Use named types for enums #1570
Conversation
* Available only if the all groupBy values are numeric and none of them are NaN. | ||
*/ | ||
public function __construct( | ||
Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, | ||
int $buckets, | ||
Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, | ||
Optional|Document|Serializable|stdClass|array $granularity = Optional::Undefined, | ||
Optional|string $granularity = Optional::Undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type was incorrect. granularity
must be a string: https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, in a previous Atlas Search PR you opted not to use enums since that might become a hindrance if something changed upstream before this library was able to apply the change.
In the event the server removed a supported string value, might that lead of a situation in the library where we'd be stuck with it out of BC obligations?
Certainly not for this implementation, since everything is just a string; however, I'm concerned with what happens if you do start modeling the server API more closely. I'm very sensitive to how that might backfire on us (similar to #1569).
'Window' => [ | ||
'acceptedTypes' => [...$bsonTypes['object']], | ||
], | ||
'GeoPoint' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to confirm that "FillOut", "Window", and "GeoPoint" were never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they were used, the generator would fail.
Fix PHPLIB-1598
When a field accepts a specific list of values, I use a named type. It will be possible to improve the parameter types later by specifying the list of accepted values.