Skip to content
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

Fix types accepted by $round builder #1401

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Sep 13, 2024

The following expression had a type error:

Expression::round(Expression::avg(Expression::doubleFieldPath('averageRating')), 2);

PHP Fatal error: Uncaught TypeError: MongoDB\Builder\Expression::round(): Argument #1 ($number) must be of type MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|MongoDB\Builder\Expression\ResolvesToDecimal|MongoDB\Builder\Expression\ResolvesToDouble|MongoDB\Builder\Expression\ResolvesToInt|MongoDB\Builder\Expression\ResolvesToLong|int|float, MongoDB\Builder\Expression\AvgOperator given, defined in src/Builder/Expression/FactoryTrait.php:1556

@GromNaN GromNaN requested a review from a team as a code owner September 13, 2024 15:53
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Thanks!

@GromNaN GromNaN merged commit f2842bc into mongodb:v1.x Sep 16, 2024
31 checks passed
@GromNaN GromNaN deleted the builder-round-avg branch September 16, 2024 08:30
alcaeus added a commit that referenced this pull request Sep 19, 2024
* v1.x: (87 commits)
  Performance: Keep collections and indexes between GridFS tests (#1421)
  Add final annotations to non-internal Operation classes (#1410)
  Fix types accepted by $round (#1401)
  Replace arrayHasKey with assertArrayHasKey in tests (#1403)
  PHPLIB-1514 Make data providers static (#1404)
  PHPLIB-1515 Replace assertObjectHasAttribute with assertObjectHasProperty (#1405)
  Restore Prose22_RangeExplicitEncryptionTest (#1400)
  Remove Prose22_RangeExplicitEncryptionTest that requires ext-mongodb < 1.20 (#1394)
  Use `match` instead of `switch` when a simple value is returned (#1393)
  Remove PHPUnit functions polyfill (#1395)
  Update branch names for GHA workflows (#1390)
  PHPLIB-1419 Encode Agg builder objects in Collection methods (#1383)
  PHPLIB-1420 Integrate query builder for non-aggregation APIs (#1385)
  Fix optional parameter declared before required parameter (#1384)
  PHPLIB-1505 Add driver option "builderEncoder" (#1382)
  Exclude rector.php from the artifact
  Check generated files are up-to-date
  Replace composer package mongodb/builder
  Skip Pedentry method sort for generated files
  Remove composer constraints already imposed by the main package
  ...
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.

2 participants