Skip to content

Commit 7793b2b

Browse files
committed
[symfony#2531] Documented dumpFile
1 parent 40af9fa commit 7793b2b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

components/filesystem.rst

+19
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,25 @@ isAbsolutePath returns true if the given path is absolute, false otherwise::
227227
// return false
228228
$fs->isAbsolutePath('../dir');
229229

230+
.. versionadded:: 2.3
231+
``dumpFile`` is new in Symfony 2.3
232+
233+
dumpFile
234+
~~~~~~~~
235+
236+
:method:`Symfony\\Component\\Filesystem\\Filesystem::dumpFile` allows you to
237+
dump contents in a file. It does it in a atomic manner, that means it writes a
238+
temporary file first and then moves that to the new place when it's finished.
239+
This means the user does see either the old or the new state
240+
241+
.. code-block:: php
242+
243+
$fs->dumpFile('file.txt', 'Hello World');
244+
245+
The ``file.txt`` file contains ``Hello World`` now.
246+
247+
A desired file mode can be passed as third argument.
248+
230249
Error Handling
231250
--------------
232251

0 commit comments

Comments
 (0)