aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-03-18 17:13:08 +0100
committerGitHub <noreply@github.com>2025-03-18 17:13:08 +0100
commit9f95c5f209fe3942dd83c68f8a40ccb00ae41413 (patch)
tree755bd913c987d2c049d1ddbd541e3445914f98a9
parent8035c8d6b80e81facea6fba362664014acbcf525 (diff)
parentd5efd17942cc901b82ccc4717b6bf755dc565997 (diff)
downloadnextcloud-server-9f95c5f209fe3942dd83c68f8a40ccb00ae41413.tar.gz
nextcloud-server-9f95c5f209fe3942dd83c68f8a40ccb00ae41413.zip
Merge pull request #51564 from nextcloud/fix/IMimeTypeDetector-types
fix(IMimeTypeDetector): use correct return type
-rw-r--r--lib/private/Files/Type/Detection.php4
-rw-r--r--lib/public/Files/IMimeTypeDetector.php10
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index 48907b3473f..09d73231f22 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -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();
diff --git a/lib/public/Files/IMimeTypeDetector.php b/lib/public/Files/IMimeTypeDetector.php
index 6f3e498c203..944b22ee1af 100644
--- a/lib/public/Files/IMimeTypeDetector.php
+++ b/lib/public/Files/IMimeTypeDetector.php
@@ -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;