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

Skip to content

Removed deprecations in Filesystem component #14145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Symfony/Component/Filesystem/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

3.0.0
-----

* removed `$mode` argument from `Filesystem::dumpFile()`

2.6.0
-----

Expand Down
11 changes: 3 additions & 8 deletions src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,12 @@ public function isAbsolutePath($file)
/**
* Atomically dumps content into a file.
*
* @param string $filename The file to be written to.
* @param string $content The data to write into the file.
* @param null|int $mode The file mode (octal). If null, file permissions are not modified
* Deprecated since version 2.3.12, to be removed in 3.0.
* @param string $filename The file to be written to.
* @param string $content The data to write into the file.
*
* @throws IOException If the file cannot be written to.
*/
public function dumpFile($filename, $content, $mode = 0666)
public function dumpFile($filename, $content)
{
$dir = dirname($filename);

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

$this->rename($tmpFile, $filename, true);
if (null !== $mode) {
$this->chmod($filename, $mode);
}
}

/**
Expand Down
19 changes: 2 additions & 17 deletions src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class FilesystemTest extends FilesystemTestCase
{
/**
* @var \Symfony\Component\Filesystem\Filesystem $filesystem
* @var \Symfony\Component\Filesystem\Filesystem
*/
private $filesystem = null;

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

$this->filesystem->dumpFile($filename, 'bar', 0753);

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

// skip mode check on Windows
if ('\\' !== DIRECTORY_SEPARATOR) {
$this->assertFilePermissions(753, $filename);
}
}

public function testDumpFileWithNullMode()
{
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';

$this->filesystem->dumpFile($filename, 'bar', null);
$this->filesystem->dumpFile($filename, 'bar');

$this->assertFileExists($filename);
$this->assertSame('bar', file_get_contents($filename));
Expand Down