From cc47ff7d72a428b141eb2504f127f358075f5263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 29 Oct 2024 17:31:50 +0100 Subject: [PATCH] Improves static analysis --- psalm-baseline.xml | 9 +++++++++ src/GridFS/CollectionWrapper.php | 5 +---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 039b43007..253df75fb 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -284,9 +284,18 @@ + + + + + filesCollection->updateMany( + ['filename' => $filename], + ['$set' => ['filename' => $newFilename]], + )->getMatchedCount()]]> + diff --git a/src/GridFS/CollectionWrapper.php b/src/GridFS/CollectionWrapper.php index 0c6b9b96c..736e47cfb 100644 --- a/src/GridFS/CollectionWrapper.php +++ b/src/GridFS/CollectionWrapper.php @@ -150,9 +150,6 @@ public function findChunksByFileId(mixed $id, int $fromChunk = 0) */ public function findFileByFilenameAndRevision(string $filename, int $revision): ?object { - $filename = $filename; - $revision = $revision; - if ($revision < 0) { $skip = abs($revision) - 1; $sortOrder = -1; @@ -266,7 +263,7 @@ public function insertFile(array|object $file): void /** * Updates the filename field in the file document for all the files with a given filename. */ - public function updateFilenameForFilename(string $filename, string $newFilename): ?int + public function updateFilenameForFilename(string $filename, string $newFilename): int { return $this->filesCollection->updateMany( ['filename' => $filename],