[HttpFoundation] removed the leading . for extensions
This commit is contained in:
parent
07be5bf484
commit
1e8cd6d34d
@ -9,6 +9,9 @@ timeline closely anyway.
|
||||
beta4 to beta5
|
||||
--------------
|
||||
|
||||
* The `Symfony\Component\HttpFoundation\File\File::getExtension()` and
|
||||
`guessExtension()` methods do not return the extension with a `.` anymore.
|
||||
|
||||
* The `em` option of the Doctrine `EntityType` class now takes the entity
|
||||
manager name instead of the EntityManager instance. If you don't pass this
|
||||
option, the default Entity Manager will be used as before.
|
||||
|
@ -484,21 +484,21 @@ class File
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the file extension (with dot).
|
||||
* Returns the file extension.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
if ($ext = pathinfo($this->getName(), PATHINFO_EXTENSION)) {
|
||||
return '.'.$ext;
|
||||
return $ext;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extension based on the mime type (with dot).
|
||||
* Returns the extension based on the mime type.
|
||||
*
|
||||
* If the mime type is unknown, returns null.
|
||||
*
|
||||
@ -509,7 +509,7 @@ class File
|
||||
$type = $this->getMimeType();
|
||||
|
||||
if (isset(self::$defaultExtensions[$type])) {
|
||||
return '.'.self::$defaultExtensions[$type];
|
||||
return self::$defaultExtensions[$type];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -116,7 +116,7 @@ class UploadedFile extends File
|
||||
}
|
||||
|
||||
if ($ext = pathinfo($this->getOriginalName(), PATHINFO_EXTENSION)) {
|
||||
return '.'.$ext;
|
||||
return $ext;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@ -47,7 +47,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetExtensionReturnsExtensionWithDot()
|
||||
{
|
||||
$this->assertEquals('.gif', $this->file->getExtension());
|
||||
$this->assertEquals('gif', $this->file->getExtension());
|
||||
}
|
||||
|
||||
public function testGetDirectoryReturnsDirectoryName()
|
||||
@ -78,7 +78,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
MimeTypeGuesser::getInstance()->register($guesser);
|
||||
|
||||
$this->assertEquals('.gif', $file->guessExtension());
|
||||
$this->assertEquals('gif', $file->guessExtension());
|
||||
}
|
||||
|
||||
public function testConstructWhenFileNotExists()
|
||||
|
Reference in New Issue
Block a user