Skip to content

Commit

Permalink
null safe on metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Mar 11, 2024
1 parent 9b6424e commit a24bc14
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/private/Files/Cache/QuerySearchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,8 @@ public function searchInCaches(ISearchQuery $searchQuery, array $caches): array
$result = $query->execute();
$files = $result->fetchAll();

$rawEntries = array_map(function (array $data) use ($metadataQuery) {
// migrate to null safe ...
if ($metadataQuery === null) {
$data['metadata'] = [];
} else {
$data['metadata'] = $metadataQuery->extractMetadata($data)->asArray();
}
$rawEntries = array_map(function (array $data) use ($metadataQuery): CacheEntry {
$data['metadata'] = $metadataQuery?->extractMetadata($data)->asArray() ?? [];

Check failure on line 198 in lib/private/Files/Cache/QuerySearchHelper.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

RedundantCondition

lib/private/Files/Cache/QuerySearchHelper.php:198:24: RedundantCondition: Type array<array-key, mixed> for $<tmp coalesce var>7379 is never null (see https://psalm.dev/122)

Check failure on line 198 in lib/private/Files/Cache/QuerySearchHelper.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

TypeDoesNotContainNull

lib/private/Files/Cache/QuerySearchHelper.php:198:78: TypeDoesNotContainNull: Cannot resolve types for $<tmp coalesce var>7379 - array<array-key, mixed> does not contain null (see https://psalm.dev/090)
return Cache::cacheEntryFromData($data, $this->mimetypeLoader);
}, $files);

Expand Down

0 comments on commit a24bc14

Please sign in to comment.