Skip to content

Commit 7c45518

Browse files
committed
Use psalm-var annotation and fix phpcs errors
1 parent 3ba3658 commit 7c45518

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/Operation/Find.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ private function createQueryOptions(): array
429429
}
430430

431431
if (! empty($this->options['modifiers'])) {
432-
/** @var array|object */
432+
/** @psalm-var array|object */
433433
$modifiers = $this->options['modifiers'];
434434
$options['modifiers'] = is_object($modifiers) ? document_to_array($modifiers) : $modifiers;
435435
}

src/Operation/FindAndModify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ private function createCommandDocument(): array
293293
}
294294

295295
if (isset($this->options['update'])) {
296-
/** @var array|object */
296+
/** @psalm-var array|object */
297297
$update = $this->options['update'];
298298
$cmd['update'] = is_pipeline($update) ? $update : (object) $update;
299299
}

src/functions.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ function document_to_array($document): array
115115
/* Nested documents and arrays are intentionally left as BSON. We avoid
116116
* iterator_to_array() since Document and PackedArray iteration returns
117117
* all values as MongoDB\BSON\Value instances. */
118-
/** @var array */
118+
119+
/** @psalm-var array */
119120
return $document->toPHP([
120121
'array' => 'bson',
121122
'document' => 'bson',
@@ -249,7 +250,7 @@ function is_pipeline($pipeline): bool
249250
/* Nested documents and arrays are intentionally left as BSON. We avoid
250251
* iterator_to_array() since Document iteration returns all values as
251252
* MongoDB\BSON\Value instances. */
252-
/** @var array */
253+
/** @psalm-var array */
253254
$pipeline = $pipeline->toPHP([
254255
'array' => 'bson',
255256
'document' => 'bson',

0 commit comments

Comments
 (0)