Skip to content

Commit a3082cd

Browse files
committed
Fix psalm issues
1 parent 6f1d624 commit a3082cd

File tree

7 files changed

+0
-28
lines changed

7 files changed

+0
-28
lines changed

src/Operation/FindOneAndUpdate.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ public function __construct(string $databaseName, string $collectionName, array|
112112
throw InvalidArgumentException::expectedDocumentType('$filter', $filter);
113113
}
114114

115-
if (! is_array($update) && ! is_object($update)) {
116-
throw InvalidArgumentException::invalidType('$update', $update, 'array or object');
117-
}
118-
119115
if (! is_first_key_operator($update) && ! is_pipeline($update)) {
120116
throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update');
121117
}

src/Operation/MapReduce.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,6 @@ class MapReduce implements Executable
157157
*/
158158
public function __construct(string $databaseName, string $collectionName, JavascriptInterface $map, JavascriptInterface $reduce, string|array|object $out, array $options = [])
159159
{
160-
if (! is_string($out) && ! is_array($out) && ! is_object($out)) {
161-
throw InvalidArgumentException::invalidType('$out', $out, 'string or array or object');
162-
}
163-
164160
if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) {
165161
throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean');
166162
}

src/Operation/Update.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ public function __construct(string $databaseName, string $collectionName, array|
113113
throw InvalidArgumentException::expectedDocumentType('$filter', $filter);
114114
}
115115

116-
if (! is_array($update) && ! is_object($update)) {
117-
throw InvalidArgumentException::invalidType('$update', $filter, 'array or object');
118-
}
119-
120116
$options += [
121117
'multi' => false,
122118
'upsert' => false,

src/Operation/UpdateMany.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ class UpdateMany implements Executable, Explainable
8383
*/
8484
public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $update, array $options = [])
8585
{
86-
if (! is_array($update) && ! is_object($update)) {
87-
throw InvalidArgumentException::invalidType('$update', $update, 'array or object');
88-
}
89-
9086
if (! is_first_key_operator($update) && ! is_pipeline($update)) {
9187
throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update');
9288
}

src/Operation/UpdateOne.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ class UpdateOne implements Executable, Explainable
8383
*/
8484
public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $update, array $options = [])
8585
{
86-
if (! is_array($update) && ! is_object($update)) {
87-
throw InvalidArgumentException::invalidType('$update', $update, 'array or object');
88-
}
89-
9086
if (! is_first_key_operator($update) && ! is_pipeline($update)) {
9187
throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update');
9288
}

src/Operation/Watch.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,6 @@ private function getInitialResumeToken()
407407
*/
408408
private function resume(array|object|null $resumeToken = null, bool $hasAdvanced = false): ChangeStreamIterator
409409
{
410-
if (isset($resumeToken) && ! is_array($resumeToken) && ! is_object($resumeToken)) {
411-
throw InvalidArgumentException::invalidType('$resumeToken', $resumeToken, 'array or object');
412-
}
413-
414410
$this->hasResumed = true;
415411

416412
/* Select a new server using the original read preference. While watch

src/functions.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ function document_to_array(array|object $document): array
153153
$document = get_object_vars($document);
154154
}
155155

156-
if (! is_array($document)) {
157-
throw InvalidArgumentException::expectedDocumentType('$document', $document);
158-
}
159-
160156
return $document;
161157
}
162158

0 commit comments

Comments
 (0)