minor #14460 [Filesystem] deprecate chmod support in dumpFile() (xabbuh)
This PR was merged into the 2.7 branch.
Discussion
----------
[Filesystem] deprecate chmod support in dumpFile()
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The ability to support a custom permission mask in the `dumpFile()` method is deprecated since Symfony Symfony 2.3.12. This commit adds the `trigger_error()` call if a custom permission mask is passed.
Commits
-------
faee0d7
[Filesystem] deprecate chmod support in dumpFile()
This commit is contained in:
commit
501df8d14c
@ -480,6 +480,10 @@ class Filesystem
|
||||
|
||||
$this->rename($tmpFile, $filename, true);
|
||||
if (null !== $mode) {
|
||||
if (func_num_args() > 2) {
|
||||
trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->chmod($filename, $mode);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||
class FilesystemTest extends FilesystemTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\Filesystem\Filesystem $filesystem
|
||||
* @var \Symfony\Component\Filesystem\Filesystem
|
||||
*/
|
||||
private $filesystem = null;
|
||||
|
||||
@ -959,6 +959,19 @@ class FilesystemTest extends FilesystemTestCase
|
||||
{
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
|
||||
$this->filesystem->dumpFile($filename, 'bar');
|
||||
|
||||
$this->assertFileExists($filename);
|
||||
$this->assertSame('bar', file_get_contents($filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testDumpFileAndSetPermissions()
|
||||
{
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
|
||||
$this->filesystem->dumpFile($filename, 'bar', 0753);
|
||||
|
||||
$this->assertFileExists($filename);
|
||||
|
Reference in New Issue
Block a user