Skip to content

Commit 9f95c5f

Browse files
authored
Merge pull request #51564 from nextcloud/fix/IMimeTypeDetector-types
fix(IMimeTypeDetector): use correct return type
2 parents 8035c8d + d5efd17 commit 9f95c5f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/private/Files/Type/Detection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Detection implements IMimeTypeDetector {
2323
private const CUSTOM_MIMETYPEMAPPING = 'mimetypemapping.json';
2424
private const CUSTOM_MIMETYPEALIASES = 'mimetypealiases.json';
2525

26-
/** @var array<string, list{string, string|null}> */
26+
/** @var array<list{string, string|null}> */
2727
protected array $mimetypes = [];
2828
protected array $secureMimeTypes = [];
2929

@@ -140,7 +140,7 @@ private function loadMappings(): void {
140140
}
141141

142142
/**
143-
* @return array<string, list{string, string|null}>
143+
* @return array<list{string, string|null}>
144144
*/
145145
public function getAllMappings(): array {
146146
$this->loadMappings();

lib/public/Files/IMimeTypeDetector.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@ public function mimeTypeIcon($mimeType);
7575
public function getAllAliases(): array;
7676

7777
/**
78-
* @return array<string, list{string, string|null}>
78+
* Get all extension to MIME type mappings.
79+
*
80+
* The return format is an array of the file extension, as the key,
81+
* mapped to a list where the first entry is the MIME type
82+
* and the second entry is the secure MIME type (or null if none).
83+
* Due to PHP idiosyncrasies if a numeric string is set as the extension,
84+
* then also the array key (file extension) is a number instead of a string.
85+
*
86+
* @return array<list{string, string|null}>
7987
* @since 32.0.0
8088
*/
8189
public function getAllMappings(): array;

0 commit comments

Comments
 (0)