Skip to content

Commit

Permalink
Improves static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 31, 2024
1 parent f1926a1 commit cc47ff7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,18 @@
</MixedArgumentTypeCoercion>
</file>
<file src="src/GridFS/CollectionWrapper.php">
<InvalidNullableReturnType>
<code><![CDATA[int]]></code>
</InvalidNullableReturnType>
<MixedAssignment>
<code><![CDATA[$ids[]]]></code>
</MixedAssignment>
<NullableReturnStatement>
<code><![CDATA[$this->filesCollection->updateMany(
['filename' => $filename],
['$set' => ['filename' => $newFilename]],
)->getMatchedCount()]]></code>
</NullableReturnStatement>
</file>
<file src="src/GridFS/ReadableStream.php">
<MixedArgument>
Expand Down
5 changes: 1 addition & 4 deletions src/GridFS/CollectionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit cc47ff7

Please sign in to comment.