Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbc331f2

Browse files
committed
[Filesystem] Add third argument$flags toFilesystem::appendToFile()
1 parentee6bbb2 commitbc331f2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎src/Symfony/Component/Filesystem/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add`Path` class
8+
*`Filesystem::appendToFile()` now accepts a third argument`$flags`, which will be added to \FILE_APPEND
89

910
5.0.0
1011
-----

‎src/Symfony/Component/Filesystem/Filesystem.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,11 +691,13 @@ public function dumpFile(string $filename, $content)
691691
/**
692692
* Appends content to an existing file.
693693
*
694+
* @param string $filename
694695
* @param string|resource $content The content to append
696+
* @param int $flags
695697
*
696698
* @throws IOException If the file is not writable
697699
*/
698-
publicfunctionappendToFile(string$filename,$content)
700+
publicfunctionappendToFile(string$filename,$content,int$flags =0)
699701
{
700702
if (\is_array($content)) {
701703
thrownew \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.',__METHOD__));
@@ -707,7 +709,7 @@ public function appendToFile(string $filename, $content)
707709
$this->mkdir($dir);
708710
}
709711

710-
if (false ===self::box('file_put_contents',$filename,$content, \FILE_APPEND)) {
712+
if (false ===self::box('file_put_contents',$filename,$content,$flags |\FILE_APPEND)) {
711713
thrownewIOException(sprintf('Failed to write file "%s":',$filename).self::$lastError,0,null,$filename);
712714
}
713715
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp