summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-foundation/File/File.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/http-foundation/File/File.php')
-rw-r--r--vendor/symfony/http-foundation/File/File.php22
1 files changed, 8 insertions, 14 deletions
diff --git a/vendor/symfony/http-foundation/File/File.php b/vendor/symfony/http-foundation/File/File.php
index de7b080973..396ff3450e 100644
--- a/vendor/symfony/http-foundation/File/File.php
+++ b/vendor/symfony/http-foundation/File/File.php
@@ -13,8 +13,7 @@ namespace Symfony\Component\HttpFoundation\File;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
-use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
+use Symfony\Component\Mime\MimeTypes;
/**
* A file in the file system.
@@ -50,33 +49,28 @@ class File extends \SplFileInfo
*
* @return string|null The guessed extension or null if it cannot be guessed
*
- * @see ExtensionGuesser
+ * @see MimeTypes
* @see getMimeType()
*/
public function guessExtension()
{
- $type = $this->getMimeType();
- $guesser = ExtensionGuesser::getInstance();
-
- return $guesser->guess($type);
+ return MimeTypes::getDefault()->getExtensions($this->getMimeType())[0] ?? null;
}
/**
* Returns the mime type of the file.
*
- * The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(),
- * mime_content_type() and the system binary "file" (in this order), depending on
- * which of those are available.
+ * The mime type is guessed using a MimeTypeGuesserInterface instance,
+ * which uses finfo_file() then the "file" system binary,
+ * depending on which of those are available.
*
* @return string|null The guessed mime type (e.g. "application/pdf")
*
- * @see MimeTypeGuesser
+ * @see MimeTypes
*/
public function getMimeType()
{
- $guesser = MimeTypeGuesser::getInstance();
-
- return $guesser->guess($this->getPathname());
+ return MimeTypes::getDefault()->guessMimeType($this->getPathname());
}
/**