Skip to content

Commit afaf1d8

Browse files
committed
Improves static analysis
1 parent 442ab34 commit afaf1d8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

psalm-baseline.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,18 @@
284284
</MixedArgumentTypeCoercion>
285285
</file>
286286
<file src="src/GridFS/CollectionWrapper.php">
287+
<InvalidNullableReturnType>
288+
<code><![CDATA[int]]></code>
289+
</InvalidNullableReturnType>
287290
<MixedAssignment>
288291
<code><![CDATA[$ids[]]]></code>
289292
</MixedAssignment>
293+
<NullableReturnStatement>
294+
<code><![CDATA[$this->filesCollection->updateMany(
295+
['filename' => $filename],
296+
['$set' => ['filename' => $newFilename]],
297+
)->getMatchedCount()]]></code>
298+
</NullableReturnStatement>
290299
</file>
291300
<file src="src/GridFS/ReadableStream.php">
292301
<MixedArgument>

src/GridFS/CollectionWrapper.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ public function findChunksByFileId(mixed $id, int $fromChunk = 0)
150150
*/
151151
public function findFileByFilenameAndRevision(string $filename, int $revision): ?object
152152
{
153-
$filename = $filename;
154-
$revision = $revision;
155-
156153
if ($revision < 0) {
157154
$skip = abs($revision) - 1;
158155
$sortOrder = -1;
@@ -266,7 +263,7 @@ public function insertFile(array|object $file): void
266263
/**
267264
* Updates the filename field in the file document for all the files with a given filename.
268265
*/
269-
public function updateFilenameForFilename(string $filename, string $newFilename): ?int
266+
public function updateFilenameForFilename(string $filename, string $newFilename): int
270267
{
271268
return $this->filesCollection->updateMany(
272269
['filename' => $filename],

0 commit comments

Comments
 (0)