package and depencies
This commit is contained in:
21
vendor/symfony/http-foundation/File/File.php
vendored
21
vendor/symfony/http-foundation/File/File.php
vendored
@@ -47,12 +47,10 @@ class File extends \SplFileInfo
|
||||
* This method uses the mime type as guessed by getMimeType()
|
||||
* to guess the file extension.
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @see MimeTypes
|
||||
* @see getMimeType()
|
||||
*/
|
||||
public function guessExtension()
|
||||
public function guessExtension(): ?string
|
||||
{
|
||||
if (!class_exists(MimeTypes::class)) {
|
||||
throw new \LogicException('You cannot guess the extension as the Mime component is not installed. Try running "composer require symfony/mime".');
|
||||
@@ -68,11 +66,9 @@ class File extends \SplFileInfo
|
||||
* which uses finfo_file() then the "file" system binary,
|
||||
* depending on which of those are available.
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @see MimeTypes
|
||||
*/
|
||||
public function getMimeType()
|
||||
public function getMimeType(): ?string
|
||||
{
|
||||
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".');
|
||||
@@ -84,11 +80,9 @@ class File extends \SplFileInfo
|
||||
/**
|
||||
* Moves the file to a new location.
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @throws FileException if the target file could not be created
|
||||
*/
|
||||
public function move(string $directory, string $name = null)
|
||||
public function move(string $directory, string $name = null): self
|
||||
{
|
||||
$target = $this->getTargetFile($directory, $name);
|
||||
|
||||
@@ -118,10 +112,7 @@ class File extends \SplFileInfo
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
protected function getTargetFile(string $directory, string $name = null)
|
||||
protected function getTargetFile(string $directory, string $name = null): self
|
||||
{
|
||||
if (!is_dir($directory)) {
|
||||
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
|
||||
@@ -138,10 +129,8 @@ class File extends \SplFileInfo
|
||||
|
||||
/**
|
||||
* Returns locale independent base name of the given path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getName(string $name)
|
||||
protected function getName(string $name): string
|
||||
{
|
||||
$originalName = str_replace('\\', '/', $name);
|
||||
$pos = strrpos($originalName, '/');
|
||||
|
||||
Reference in New Issue
Block a user