@@ -137,7 +137,7 @@ final class BulkWrite
137137 * 
138138 * @param string $databaseName Database name 
139139 * @param string $collectionName Collection name 
140-  * @param array $operations List of write operations 
140+  * @param array $operations List of write operations 
141141 * @psalm-param list<OperationType> $operations 
142142 * @param array $options Command options 
143143 * @throws InvalidArgumentException for parameter/option parsing errors 
@@ -285,7 +285,7 @@ private function createExecuteOptions(): array
285285 */ 
286286 private  function  validateOperations (array  $ operationsDocumentCodec $ codecEncoder $ builderEncoderarray 
287287 {
288-  foreach  ($ operationsas  $ i$ operation
288+  foreach  ($ operationsas  $ i& $ operation
289289 if  (! is_array ($ operation
290290 throw  InvalidArgumentException::invalidType (sprintf ('$operations[%d] ' , $ i$ operation'array ' );
291291 }
@@ -310,14 +310,14 @@ private function validateOperations(array $operations, ?DocumentCodec $codec, En
310310 // $args[0] was already validated above. Since DocumentCodec::encode will always return a Document 
311311 // instance, there is no need to re-validate the returned value here. 
312312 if  ($ codec
313-  $ operations [ $ i ] [$ type0 ] = $ codecencode ($ args0 ]);
313+  $ operation $ type0 ] = $ codecencode ($ args0 ]);
314314 }
315315
316316 break ;
317317
318318 case  self ::DELETE_MANY :
319319 case  self ::DELETE_ONE :
320-  $ operations [ $ i ] [$ type0 ] = $ builderEncoderencodeIfSupported ($ args0 ]);
320+  $ operation $ type0 ] = $ builderEncoderencodeIfSupported ($ args0 ]);
321321
322322 if  (! isset ($ args1 ])) {
323323 $ args1 ] = [];
@@ -333,19 +333,19 @@ private function validateOperations(array $operations, ?DocumentCodec $codec, En
333333 throw  InvalidArgumentException::expectedDocumentType (sprintf ('$operations[%d]["%s"][1]["collation"] ' , $ i$ type$ args1 ]['collation ' ]);
334334 }
335335
336-  $ operations [ $ i ] [$ type1 ] = $ args1 ];
336+  $ operation $ type1 ] = $ args1 ];
337337
338338 break ;
339339
340340 case  self ::REPLACE_ONE :
341-  $ operations [ $ i ] [$ type0 ] = $ builderEncoderencodeIfSupported ($ args0 ]);
341+  $ operation $ type0 ] = $ builderEncoderencodeIfSupported ($ args0 ]);
342342
343343 if  (! isset ($ args1 ]) && ! array_key_exists (1 , $ args
344344 throw  new  InvalidArgumentException (sprintf ('Missing second argument for $operations[%d]["%s"] ' , $ i$ type
345345 }
346346
347347 if  ($ codec
348-  $ operations [ $ i ] [$ type1 ] = $ codecencode ($ args1 ]);
348+  $ operation $ type1 ] = $ codecencode ($ args1 ]);
349349 }
350350
351351 if  (! is_document ($ args1 ])) {
@@ -388,19 +388,19 @@ private function validateOperations(array $operations, ?DocumentCodec $codec, En
388388 throw  InvalidArgumentException::invalidType (sprintf ('$operations[%d]["%s"][2]["upsert"] ' , $ i$ type$ args2 ]['upsert ' ], 'boolean ' );
389389 }
390390
391-  $ operations [ $ i ] [$ type2 ] = $ args2 ];
391+  $ operation $ type2 ] = $ args2 ];
392392
393393 break ;
394394
395395 case  self ::UPDATE_MANY :
396396 case  self ::UPDATE_ONE :
397-  $ operations [ $ i ] [$ type0 ] = $ builderEncoderencodeIfSupported ($ args0 ]);
397+  $ operation $ type0 ] = $ builderEncoderencodeIfSupported ($ args0 ]);
398398
399399 if  (! isset ($ args1 ]) && ! array_key_exists (1 , $ args
400400 throw  new  InvalidArgumentException (sprintf ('Missing second argument for $operations[%d]["%s"] ' , $ i$ type
401401 }
402402
403-  $ operations [ $ i ] [$ type1 ] = $ args1 ] = $ builderEncoderencodeIfSupported ($ args1 ]);
403+  $ operation $ type1 ] = $ args1 ] = $ builderEncoderencodeIfSupported ($ args1 ]);
404404
405405 if  ((! is_document ($ args1 ]) || ! is_first_key_operator ($ args1 ])) && ! is_pipeline ($ args1 ])) {
406406 throw  new  InvalidArgumentException (sprintf ('Expected update operator(s) or non-empty pipeline for $operations[%d]["%s"][1] ' , $ i$ type
@@ -437,7 +437,7 @@ private function validateOperations(array $operations, ?DocumentCodec $codec, En
437437 throw  InvalidArgumentException::invalidType (sprintf ('$operations[%d]["%s"][2]["upsert"] ' , $ i$ type$ args2 ]['upsert ' ], 'boolean ' );
438438 }
439439
440-  $ operations [ $ i ] [$ type2 ] = $ args2 ];
440+  $ operation $ type2 ] = $ args2 ];
441441
442442 break ;
443443
0 commit comments