Skip to content

Commit 5b38a82

Browse files
committed
Rewrite conditional to avoid suppressing psalm errors
1 parent c84d4ed commit 5b38a82

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/GridFS/Bucket.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,10 @@ public function uploadFromStream(string $filename, $source, array $options = [])
645645
*/
646646
private function createPathForFile(object $file): string
647647
{
648-
if (! is_object($file->_id) || method_exists($file->_id, '__toString')) {
649-
/** @psalm-suppress PossiblyInvalidCast */
650-
$id = (string) $file->_id;
651-
} else {
648+
if (is_array($file->_id) || (is_object($file->_id) && ! method_exists($file->_id, '__toString'))) {
652649
$id = toJSON(fromPHP(['_id' => $file->_id]));
650+
} else {
651+
$id = (string) $file->_id;
653652
}
654653

655654
return sprintf(

0 commit comments

Comments
 (0)