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

Skip to content

Commit 5b117e6

Browse files
committed
feature #14145 Removed deprecations in Filesystem component (dosten)
This PR was squashed before being merged into the 3.0-dev branch (closes #14145). Discussion ---------- Removed deprecations in Filesystem component | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 5d1e558 Removed deprecations in Filesystem component
2 parents 5e623a9 + 5d1e558 commit 5b117e6

File tree

3 files changed

+8
-41
lines changed

3 files changed

+8
-41
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 & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,12 @@ public function isAbsolutePath($file)
451451
/**
452452
* Atomically dumps content into a file.
453453
*
454-
* @param string $filename The file to be written to.
455-
* @param string $content The data to write into the file.
456-
* @param null|int $mode The file mode (octal). If null, file permissions are not modified
457-
* Deprecated since version 2.3.12, to be removed in 3.0.
454+
* @param string $filename The file to be written to.
455+
* @param string $content The data to write into the file.
458456
*
459457
* @throws IOException If the file cannot be written to.
460458
*/
461-
public function dumpFile($filename, $content, $mode = 0666)
459+
public function dumpFile($filename, $content)
462460
{
463461
$dir = dirname($filename);
464462

@@ -475,13 +473,6 @@ public function dumpFile($filename, $content, $mode = 0666)
475473
}
476474

477475
$this->rename($tmpFile, $filename, true);
478-
if (null !== $mode) {
479-
if (func_num_args() > 2) {
480-
trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
481-
}
482-
483-
$this->chmod($filename, $mode);
484-
}
485476
}
486477

487478
/**

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -960,35 +960,6 @@ public function testDumpFile()
960960
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
961961

962962
$this->filesystem->dumpFile($filename, 'bar');
963-
964-
$this->assertFileExists($filename);
965-
$this->assertSame('bar', file_get_contents($filename));
966-
}
967-
968-
/**
969-
* @group legacy
970-
*/
971-
public function testDumpFileAndSetPermissions()
972-
{
973-
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
974-
975-
$this->filesystem->dumpFile($filename, 'bar', 0753);
976-
977-
$this->assertFileExists($filename);
978-
$this->assertSame('bar', file_get_contents($filename));
979-
980-
// skip mode check on Windows
981-
if ('\\' !== DIRECTORY_SEPARATOR) {
982-
$this->assertFilePermissions(753, $filename);
983-
}
984-
}
985-
986-
public function testDumpFileWithNullMode()
987-
{
988-
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
989-
990-
$this->filesystem->dumpFile($filename, 'bar', null);
991-
992963
$this->assertFileExists($filename);
993964
$this->assertSame('bar', file_get_contents($filename));
994965

0 commit comments

Comments
 (0)