Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7ee0ec

Browse files
committed
[HttpFoundation] updated File code
1 parent5aa0967 commitd7ee0ec

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,23 @@ public function __construct(string $path, bool $checkPath = true)
5555
*/
5656
publicfunctionguessExtension()
5757
{
58-
$type =$this->getMimeType();
59-
$guesser = ExtensionGuesser::getInstance();
60-
61-
return$guesser->guess($type);
58+
return ExtensionGuesser::getInstance()->guess($this->getMimeType());
6259
}
6360

6461
/**
6562
* Returns the mime type of the file.
6663
*
67-
* The mime type is guessed using aMimeTypeGuesser instance, which uses finfo(),
68-
*mime_content_type()and thesystem binary"file"(in this order), depending on
69-
* which of those are available.
64+
* The mime type is guessed using aMimeTypeGuesserInterface instance,
65+
*which uses finfo_file()then the "file"system binary,
66+
*depending onwhich of those are available.
7067
*
7168
* @return string|null The guessed mime type (e.g. "application/pdf")
7269
*
7370
* @see MimeTypeGuesser
7471
*/
7572
publicfunctiongetMimeType()
7673
{
77-
$guesser = MimeTypeGuesser::getInstance();
78-
79-
return$guesser->guess($this->getPathname());
74+
return MimeTypeGuesser::getInstance()->guess($this->getPathname());
8075
}
8176

8277
/**

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,7 @@ public function getClientMimeType()
140140
*/
141141
publicfunctionguessClientExtension()
142142
{
143-
$type =$this->getClientMimeType();
144-
$guesser = ExtensionGuesser::getInstance();
145-
146-
return$guesser->guess($type);
143+
return ExtensionGuesser::getInstance()->guess($this->getClientMimeType());
147144
}
148145

149146
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp