Skip to content

Commit 006d1f5

Browse files
committed
Use assert for ambuguous type
1 parent d54bec9 commit 006d1f5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

psalm-baseline.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,13 @@
417417
</DocblockTypeContradiction>
418418
</file>
419419
<file src="src/Operation/CreateCollection.php">
420-
<MixedArgument occurrences="3">
421-
<code>$i</code>
420+
<MixedArgument occurrences="2">
422421
<code>$i</code>
423422
<code>$this-&gt;options['typeMap']</code>
424423
</MixedArgument>
425-
<MixedAssignment occurrences="3">
424+
<MixedAssignment occurrences="4">
426425
<code>$cmd[$option]</code>
426+
<code>$i</code>
427427
<code>$options['session']</code>
428428
<code>$options['writeConcern']</code>
429429
</MixedAssignment>

src/Operation/CreateCollection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use MongoDB\Exception\InvalidArgumentException;
2626

2727
use function array_is_list;
28+
use function assert;
2829
use function current;
2930
use function is_array;
3031
use function is_bool;
@@ -242,7 +243,9 @@ public function __construct(string $databaseName, string $collectionName, array
242243
}
243244

244245
if (isset($options['pipeline'])) {
245-
if (! array_is_list($options['pipeline'])) {
246+
$pipeline = $options['pipeline'];
247+
assert(is_array($pipeline));
248+
if (! array_is_list($pipeline)) {
246249
throw new InvalidArgumentException('The "pipeline" option is not a list');
247250
}
248251

0 commit comments

Comments
 (0)