@@ -101,10 +101,8 @@ private function encodeAsDollarObject(OperatorInterface $value): stdClass
101
101
/**
102
102
* $group stage have a specific encoding because the _id argument is required and others are variadic
103
103
*/
104
- private function encodeAsGroup (OperatorInterface $ value ): stdClass
104
+ private function encodeAsGroup (GroupStage $ value ): stdClass
105
105
{
106
- assert ($ value instanceof GroupStage);
107
-
108
106
$ result = new stdClass ();
109
107
$ result ->_id = $ this ->recursiveEncode ($ value ->_id );
110
108
@@ -132,10 +130,8 @@ private function encodeAsObject(OperatorInterface $value): stdClass
132
130
: $ this ->wrap ($ value , $ result );
133
131
}
134
132
135
- private function encodeAsSearch (OperatorInterface $ value ): stdClass
133
+ private function encodeAsSearch (SearchStage | SearchMetaStage $ value ): stdClass
136
134
{
137
- assert ($ value instanceof SearchStage || $ value instanceof SearchMetaStage);
138
-
139
135
$ result = new stdClass ();
140
136
foreach (get_object_vars ($ value ) as $ key => $ val ) {
141
137
// Skip optional arguments. If they have a default value, it is resolved by the server.
@@ -147,7 +143,7 @@ private function encodeAsSearch(OperatorInterface $value): stdClass
147
143
if ($ key === 'operator ' ) {
148
144
$ val = $ this ->recursiveEncode ($ val );
149
145
assert ($ val instanceof stdClass);
150
- foreach (get_object_vars ( $ val) as $ subkey => $ subval ) {
146
+ foreach ($ val as $ subkey => $ subval ) {
151
147
$ result ->{$ subkey } = $ subval ;
152
148
}
153
149
0 commit comments