changeExtension() public static method

Changes the extension of a path string.
Since: 1.1 Added method.
Since: 2.0 Method now fails if $path or $extension is not a string.
public static changeExtension ( string $path, string $extension ) : string
$path string The path string with filename.ext to change.
$extension string New extension (with or without leading dot).
return string The path string with new file extension.
示例#1
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage The extension must be a string. Got: array
  */
 public function testChangeExtensionFailsIfInvalidExtension()
 {
     Path::changeExtension('/style.css', array());
 }