Skip to content

Commit

Permalink
Wording
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Dec 2, 2024
1 parent acb5520 commit 0d6ba87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 12 additions & 11 deletions generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ The `generator/config/*.yaml` files contains the list of operators and stages th

### Arguments

| Field | Type | Description |
| `name` | `string` | The name of the argument. It can start with `$` when the aggregation operator needs it, but it will be trimmed from the class property name. |
| `type` | list of `string` | The list of accepted types |
| `description` | `string` | The description of the argument from MongoDB's documentation. |
| `optional` | `boolean` | Whether the argument is optional or not. |
| `valueMin` | `number` | The minimum value for a numeric argument. |
| `valueMax` | `number` | The maximum value for a numeric argument. |
| `variadic` | `string` | If sent, the argument is variadic. Defines the format `array` for a list or `object` for a map |
| `variadicMin` | `integer` | The minimum number of arguments for a variadic parameter. |
| `default` | `scalar` or `array` | The default value for the argument. |
| `mergeObject` | `bool` | Default `false`. If `true`, the value must be an object and the properties of the value object are merged into the parent operator. `$group` stage uses it for the fields. |
| Field | Type | Description |
|---------------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | `string` | The name of the argument. If it starts with `$`, the dollar is trimmed from the class property name |
| `type` | list of `string` | The list of accepted types |
| `description` | `string` | The description of the argument from MongoDB's documentation |
| `optional` | `boolean` | Whether the argument is optional or not |
| `valueMin` | `number` | The minimum value for a numeric argument |
| `valueMax` | `number` | The maximum value for a numeric argument |
| `variadic` | `string` | If sent, the argument is variadic. Defines the format `array` for a list or `object` for a map |
| `variadicMin` | `integer` | The minimum number of arguments for a variadic parameter |
| `default` | `scalar` or `array` | The default value for the argument |
| `mergeObject` | `bool` | Default `false`. If `true`, the value must be an object and the properties of the value object are merged into the parent operator. `$group` stage uses it for the fields |

### Test pipelines

Expand Down
2 changes: 2 additions & 0 deletions src/Builder/Encoder/OperatorEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ private function encodeAsObject(OperatorInterface $value): stdClass
continue;
}

// The name is null for arguments with "mergeObject: true" in the YAML file,
// the value properties are merged into the parent object.

Check notice

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $val is being assigned to
if ($name === null) {

Check notice

Code scanning / Psalm

PossibleRawObjectIteration Note

Possibly undesired iteration over regular object stdClass

Check notice

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $k is being assigned to

Check notice

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $v is being assigned to
$val = $this->recursiveEncode($val);
foreach ($val as $k => $v) {
Expand Down

0 comments on commit 0d6ba87

Please sign in to comment.