Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d1e558

Browse files
dostenfabpot
authored andcommitted
Removed deprecations in Filesystem component
1 parent 3be0923 commit 5d1e558

File tree

3 files changed

+10
-25
lines changed

3 files changed

+10
-25
lines changed

src/Symfony/Component/Filesystem/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
3.0.0
5+
-----
6+
7+
* removed `$mode` argument from `Filesystem::dumpFile()`
8+
49
2.6.0
510
-----
611

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,14 +455,12 @@ public function isAbsolutePath($file)
455455
/**
456456
* Atomically dumps content into a file.
457457
*
458-
* @param string $filename The file to be written to.
459-
* @param string $content The data to write into the file.
460-
* @param null|int $mode The file mode (octal). If null, file permissions are not modified
461-
* Deprecated since version 2.3.12, to be removed in 3.0.
458+
* @param string $filename The file to be written to.
459+
* @param string $content The data to write into the file.
462460
*
463461
* @throws IOException If the file cannot be written to.
464462
*/
465-
public function dumpFile($filename, $content, $mode = 0666)
463+
public function dumpFile($filename, $content)
466464
{
467465
$dir = dirname($filename);
468466

@@ -479,9 +477,6 @@ public function dumpFile($filename, $content, $mode = 0666)
479477
}
480478

481479
$this->rename($tmpFile, $filename, true);
482-
if (null !== $mode) {
483-
$this->chmod($filename, $mode);
484-
}
485480
}
486481

487482
/**

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class FilesystemTest extends FilesystemTestCase
2020
{
2121
/**
22-
* @var \Symfony\Component\Filesystem\Filesystem $filesystem
22+
* @var \Symfony\Component\Filesystem\Filesystem
2323
*/
2424
private $filesystem = null;
2525

@@ -959,22 +959,7 @@ public function testDumpFile()
959959
{
960960
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
961961

962-
$this->filesystem->dumpFile($filename, 'bar', 0753);
963-
964-
$this->assertFileExists($filename);
965-
$this->assertSame('bar', file_get_contents($filename));
966-
967-
// skip mode check on Windows
968-
if ('\\' !== DIRECTORY_SEPARATOR) {
969-
$this->assertFilePermissions(753, $filename);
970-
}
971-
}
972-
973-
public function testDumpFileWithNullMode()
974-
{
975-
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
976-
977-
$this->filesystem->dumpFile($filename, 'bar', null);
962+
$this->filesystem->dumpFile($filename, 'bar');
978963

979964
$this->assertFileExists($filename);
980965
$this->assertSame('bar', file_get_contents($filename));

0 commit comments

Comments
 (0)