Skip to content

Commit 101bb44

Browse files
committed
Fix psalm issues
1 parent 519065b commit 101bb44

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

psalm-baseline.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,6 @@
135135
<code>stdClass</code>
136136
</MoreSpecificReturnType>
137137
</file>
138-
<file src="src/Model/BSONIterator.php">
139-
<MixedArgument>
140-
<code>$documentLength</code>
141-
<code>$documentLength</code>
142-
<code><![CDATA[$this->options['typeMap']]]></code>
143-
</MixedArgument>
144-
<MixedAssignment>
145-
<code><![CDATA[$this->position]]></code>
146-
</MixedAssignment>
147-
<MixedOperand>
148-
<code>$documentLength</code>
149-
</MixedOperand>
150-
</file>
151138
<file src="src/Model/ChangeStreamIterator.php">
152139
<MixedArgument>
153140
<code><![CDATA[$reply->cursor->nextBatch]]></code>

src/Model/BSONIterator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
use MongoDB\Exception\UnexpectedValueException;
2424
use ReturnTypeWillChange;
2525

26+
use function assert;
2627
use function is_array;
28+
use function is_int;
2729
use function sprintf;
2830
use function strlen;
2931
use function substr;
@@ -49,6 +51,7 @@ class BSONIterator implements Iterator
4951

5052
private int $position = 0;
5153

54+
/** @var array{typeMap: array, ...} */
5255
private array $options;
5356

5457
/**
@@ -142,6 +145,7 @@ private function advance(): void
142145
}
143146

144147
[, $documentLength] = unpack('V', substr($this->buffer, $this->position, self::BSON_SIZE));
148+
assert(is_int($documentLength));
145149

146150
if ($this->bufferLength - $this->position < $documentLength) {
147151
throw new UnexpectedValueException(sprintf('Expected %d bytes; %d remaining', $documentLength, $this->bufferLength - $this->position));

0 commit comments

Comments
 (0)