@@ -101,10 +101,8 @@ private function encodeAsDollarObject(OperatorInterface $value): stdClass
101101 /**
102102 * $group stage have a specific encoding because the _id argument is required and others are variadic
103103 */
104- private function encodeAsGroup (OperatorInterface $ value ): stdClass
104+ private function encodeAsGroup (GroupStage $ value ): stdClass
105105 {
106- assert ($ value instanceof GroupStage);
107-
108106 $ result = new stdClass ();
109107 $ result ->_id = $ this ->recursiveEncode ($ value ->_id );
110108
@@ -132,10 +130,8 @@ private function encodeAsObject(OperatorInterface $value): stdClass
132130 : $ this ->wrap ($ value , $ result );
133131 }
134132
135- private function encodeAsSearch (OperatorInterface $ value ): stdClass
133+ private function encodeAsSearch (SearchStage | SearchMetaStage $ value ): stdClass
136134 {
137- assert ($ value instanceof SearchStage || $ value instanceof SearchMetaStage);
138-
139135 $ result = new stdClass ();
140136 foreach (get_object_vars ($ value ) as $ key => $ val ) {
141137 // 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
147143 if ($ key === 'operator ' ) {
148144 $ val = $ this ->recursiveEncode ($ val );
149145 assert ($ val instanceof stdClass);
150- foreach (get_object_vars ( $ val) as $ subkey => $ subval ) {
146+ foreach ($ val as $ subkey => $ subval ) {
151147 $ result ->{$ subkey } = $ subval ;
152148 }
153149
0 commit comments