minor #14366 [HttpFoundation] remove getExtension method (dosten)
This PR was squashed before being merged into the 2.7 branch (closes #14366).
Discussion
----------
[HttpFoundation] remove getExtension method
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Since the minimum PHP version in 2.7 is 5.3.9 we can delete the `getExtension` method and use the real `\SplFileInfo::getExtension()`
Commits
-------
55ecf3b
[HttpFoundation] remove getExtension method
This commit is contained in:
commit
d5ed6ecdf6
|
@ -87,20 +87,6 @@ class File extends \SplFileInfo
|
|||
return $guesser->guess($this->getPathname());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extension of the file.
|
||||
*
|
||||
* \SplFileInfo::getExtension() is not available before PHP 5.3.6
|
||||
*
|
||||
* @return string The extension
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
return pathinfo($this->getBasename(), PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the file to a new location.
|
||||
*
|
||||
|
|
|
@ -148,12 +148,6 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
|||
@rmdir($targetDir);
|
||||
}
|
||||
|
||||
public function testGetExtension()
|
||||
{
|
||||
$file = new File(__DIR__.'/Fixtures/test.gif');
|
||||
$this->assertEquals('gif', $file->getExtension());
|
||||
}
|
||||
|
||||
protected function createMockGuesser($path, $mimeType)
|
||||
{
|
||||
$guesser = $this->getMock('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface');
|
||||
|
|
Reference in New Issue