8000 [HttpFoundation] Fixed Mimes dependency missing error · symfony/symfony@fef0de3 · GitHub
[go: up one dir, main page]

Skip to content

Commit fef0de3

Browse files
committed
[HttpFoundation] Fixed Mimes dependency missing error
1 parent f46ab58 commit fef0de3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

UPGRADE-5.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ HttpFoundation
3636
* Deprecate `Response::create()`, `JsonResponse::create()`,
3737
`RedirectResponse::create()`, and `StreamedResponse::create()` methods (use
3838
`__construct()` instead)
39+
* Made the Mime component an optional dependency
3940

4041
Messenger
4142
---------

src/Symfony/Component/HttpFoundation/File/File.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function guessExtension()
7474
*/
7575
public function getMimeType()
7676
{
77+
if (!class_exists(MimeTypes::class)) {
78+
throw new \LogicException('You cannot guess the mime type as the Mime component is not installed. Try running "composer require symfony/mime".');
79+
}
80+
7781
return MimeTypes::getDefault()->guessMimeType($this->getPathname());
7882
}
7983

0 commit comments

Comments
 (0)
0