[HttpFoundation] Fixed Mimes dependency missing error
This commit is contained in:
parent
f46ab58bcf
commit
fef0de3eb6
@ -36,6 +36,7 @@ HttpFoundation
|
||||
* Deprecate `Response::create()`, `JsonResponse::create()`,
|
||||
`RedirectResponse::create()`, and `StreamedResponse::create()` methods (use
|
||||
`__construct()` instead)
|
||||
* Made the Mime component an optional dependency
|
||||
|
||||
Messenger
|
||||
---------
|
||||
|
@ -74,6 +74,10 @@ class File extends \SplFileInfo
|
||||
*/
|
||||
public function getMimeType()
|
||||
{
|
||||
if (!class_exists(MimeTypes::class)) {
|
||||
throw new \LogicException('You cannot guess the mime type as the Mime component is not installed. Try running "composer require symfony/mime".');
|
||||
}
|
||||
|
||||
return MimeTypes::getDefault()->guessMimeType($this->getPathname());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user