Fix types in mimes.php

This commit is contained in:
Jill Stingray 2020-06-14 18:34:59 +03:00
parent 5f29e67c56
commit f73c48dd50

View file

@ -1,4 +1,5 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
function system_extension_mime_types(): array function system_extension_mime_types(): array
{ {
# Returns the system MIME type mapping of extensions to MIME types, as defined in /etc/mime.types. # Returns the system MIME type mapping of extensions to MIME types, as defined in /etc/mime.types.
@ -19,7 +20,7 @@ function system_extension_mime_types(): array
return $out; return $out;
} }
function system_extension_mime_type(string $file): string function system_extension_mime_type(string $file): ?string
{ {
# Returns the system MIME type (as defined in /etc/mime.types) for the filename specified. # Returns the system MIME type (as defined in /etc/mime.types) for the filename specified.
# #
@ -60,7 +61,7 @@ function system_mime_type_extensions(): array
return $out; return $out;
} }
function system_mime_type_extension(string $type): string function system_mime_type_extension(string $type): ?string
{ {
# Returns the canonical file extension for the MIME type specified, as defined in /etc/mime.types (considering the first # Returns the canonical file extension for the MIME type specified, as defined in /etc/mime.types (considering the first
# extension listed to be canonical). # extension listed to be canonical).
@ -70,4 +71,4 @@ function system_mime_type_extension(string $type): string
if(!isset($exts)) if(!isset($exts))
$exts = system_mime_type_extensions(); $exts = system_mime_type_extensions();
return isset($exts[$type]) ? $exts[$type] : null; return isset($exts[$type]) ? $exts[$type] : null;
} }