Merge pull request #51564 from nextcloud/fix/IMimeTypeDetector-types

fix(IMimeTypeDetector): use correct return type
This commit is contained in:
Ferdinand Thiessen 2025-03-18 17:13:08 +01:00 committed by GitHub
commit 9f95c5f209
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -23,7 +23,7 @@ class Detection implements IMimeTypeDetector {
private const CUSTOM_MIMETYPEMAPPING = 'mimetypemapping.json';
private const CUSTOM_MIMETYPEALIASES = 'mimetypealiases.json';
/** @var array<string, list{string, string|null}> */
/** @var array<list{string, string|null}> */
protected array $mimetypes = [];
protected array $secureMimeTypes = [];
@ -140,7 +140,7 @@ class Detection implements IMimeTypeDetector {
}
/**
* @return array<string, list{string, string|null}>
* @return array<list{string, string|null}>
*/
public function getAllMappings(): array {
$this->loadMappings();

View file

@ -75,7 +75,15 @@ interface IMimeTypeDetector {
public function getAllAliases(): array;
/**
* @return array<string, list{string, string|null}>
* Get all extension to MIME type mappings.
*
* The return format is an array of the file extension, as the key,
* mapped to a list where the first entry is the MIME type
* and the second entry is the secure MIME type (or null if none).
* Due to PHP idiosyncrasies if a numeric string is set as the extension,
* then also the array key (file extension) is a number instead of a string.
*
* @return array<list{string, string|null}>
* @since 32.0.0
*/
public function getAllMappings(): array;