Commit a1e60190 authored by Jeremy Mikola's avatar Jeremy Mikola

Relax writeConcern option checks in operation classes

We only use the writeConcern option if isset() return true, so we needn't complain about users passing a null value.
parent 8baaedb8
...@@ -188,7 +188,7 @@ class BulkWrite implements Executable ...@@ -188,7 +188,7 @@ class BulkWrite implements Executable
throw new InvalidArgumentTypeException('"ordered" option', $options['ordered'], 'boolean'); throw new InvalidArgumentTypeException('"ordered" option', $options['ordered'], 'boolean');
} }
if (array_key_exists('writeConcern', $options) && ! $options['writeConcern'] instanceof WriteConcern) { if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) {
throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern'); throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern');
} }
......
...@@ -52,7 +52,7 @@ class Delete implements Executable ...@@ -52,7 +52,7 @@ class Delete implements Executable
throw new InvalidArgumentException('$limit must be 0 or 1'); throw new InvalidArgumentException('$limit must be 0 or 1');
} }
if (array_key_exists('writeConcern', $options) && ! $options['writeConcern'] instanceof WriteConcern) { if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) {
throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern'); throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern');
} }
......
...@@ -68,7 +68,7 @@ class InsertMany implements Executable ...@@ -68,7 +68,7 @@ class InsertMany implements Executable
throw new InvalidArgumentTypeException('"ordered" option', $options['ordered'], 'boolean'); throw new InvalidArgumentTypeException('"ordered" option', $options['ordered'], 'boolean');
} }
if (array_key_exists('writeConcern', $options) && ! $options['writeConcern'] instanceof WriteConcern) { if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) {
throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern'); throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern');
} }
......
...@@ -41,7 +41,7 @@ class InsertOne implements Executable ...@@ -41,7 +41,7 @@ class InsertOne implements Executable
throw new InvalidArgumentTypeException('$document', $document, 'array or object'); throw new InvalidArgumentTypeException('$document', $document, 'array or object');
} }
if (array_key_exists('writeConcern', $options) && ! $options['writeConcern'] instanceof WriteConcern) { if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) {
throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern'); throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern');
} }
......
...@@ -75,7 +75,7 @@ class Update implements Executable ...@@ -75,7 +75,7 @@ class Update implements Executable
throw new InvalidArgumentTypeException('"upsert" option', $options['upsert'], 'boolean'); throw new InvalidArgumentTypeException('"upsert" option', $options['upsert'], 'boolean');
} }
if (array_key_exists('writeConcern', $options) && ! $options['writeConcern'] instanceof WriteConcern) { if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) {
throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern'); throw new InvalidArgumentTypeException('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment