Skip to content

Commit 05f1aaf

Browse files
committed
Merge pull request symfony#2592 from WouterJ/issue_2531
Documented dumpFile
2 parents 50d6886 + 7793b2b commit 05f1aaf

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
@@ -223,6 +223,25 @@ isAbsolutePath returns true if the given path is absolute, false otherwise::
223223
// return false
224224
$fs->isAbsolutePath('../dir');
225225

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

0 commit comments

Comments
 (0)