4040use function array_key_exists ;
4141use function array_map ;
4242use function array_merge ;
43+ use function array_replace ;
4344use function array_values ;
4445use function assert ;
4546use function blank ;
@@ -426,7 +427,7 @@ public function toMql(): array
426427
427428 // Add custom query options
428429 if (count ($ this ->options )) {
429- $ options = array_merge ($ options , $ this ->options );
430+ $ options = array_replace ($ options , $ this ->options );
430431 }
431432
432433 $ options = $ this ->inheritConnectionOptions ($ options );
@@ -450,7 +451,7 @@ public function toMql(): array
450451
451452 // Add custom projections.
452453 if ($ this ->projections ) {
453- $ projection = array_merge ($ projection , $ this ->projections );
454+ $ projection = array_replace ($ projection , $ this ->projections );
454455 }
455456
456457 $ options = [];
@@ -484,7 +485,7 @@ public function toMql(): array
484485
485486 // Add custom query options
486487 if (count ($ this ->options )) {
487- $ options = array_merge ($ options , $ this ->options );
488+ $ options = array_replace ($ options , $ this ->options );
488489 }
489490
490491 $ options = $ this ->inheritConnectionOptions ($ options );
0 commit comments