Skip to content

Commit 84a94de

Browse files
committed
PHPLIB-1532: Emit deprecation notice for modifiers and oplogReplay options
1 parent 2109214 commit 84a94de

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/Operation/Find.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,20 @@ public function __construct(string $databaseName, string $collectionName, $filte
292292
unset($options['readConcern']);
293293
}
294294

295-
if (isset($options['snapshot'])) {
296-
trigger_error('The "snapshot" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
295+
if (isset($options['maxScan'])) {
296+
@trigger_error('The "maxScan" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
297297
}
298298

299-
if (isset($options['maxScan'])) {
300-
trigger_error('The "maxScan" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
299+
if (isset($options['modifiers'])) {
300+
@trigger_error('The "modifiers" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
301+
}
302+
303+
if (isset($options['oplogReplay'])) {
304+
@trigger_error('The "oplogReplay" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
305+
}
306+
307+
if (isset($options['snapshot'])) {
308+
@trigger_error('The "snapshot" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
301309
}
302310

303311
if (isset($options['codec']) && isset($options['typeMap'])) {

tests/Operation/FindTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ public function testMaxScanOptionIsDeprecated(): void
7171
});
7272
}
7373

74+
public function testModifiersOptionIsDeprecated(): void
75+
{
76+
$this->assertDeprecated(function (): void {
77+
new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['modifiers' => []]);
78+
});
79+
}
80+
81+
public function testOplogReplayOptionIsDeprecated(): void
82+
{
83+
$this->assertDeprecated(function (): void {
84+
new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['oplogReplay' => true]);
85+
});
86+
}
87+
7488
/** @dataProvider provideInvalidConstructorCursorTypeOptions */
7589
public function testConstructorCursorTypeOption($cursorType): void
7690
{

0 commit comments

Comments
 (0)