Skip to content

Commit 50ed36a

Browse files
committed
FileInterface documentation
1 parent e60e41a commit 50ed36a

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

src/Node/FileInterface.php

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,86 @@
44

55
use React\Filesystem\AdapterInterface;
66
use React\Promise\PromiseInterface;
7+
use React\Stream\WritableStreamInterface;
78

89
interface FileInterface extends NodeInterface
910
{
1011
/**
11-
* @return \React\Promise\PromiseInterface
12+
* Returns true when the file exists
13+
*
14+
* @return PromiseInterface
1215
*/
1316
public function exists();
1417

1518
/**
16-
* @return \React\Promise\PromiseInterface
19+
* Remove the file
20+
*
21+
* @return PromiseInterface
1722
*/
1823
public function remove();
1924

2025
/**
26+
* Open the file and return a promise resolve into a stream that can be read from or written to.
27+
*
2128
* @param $flags
2229
* @param string $mode
23-
* @return mixed
30+
* @return PromiseInterface<GenericStreamInterface>
2431
*/
2532
public function open($flags, $mode = AdapterInterface::CREATION_MODE);
2633

2734
/**
28-
* @return \React\Promise\PromiseInterface
35+
* Return the change time, access time, and modification time
36+
*
37+
* @return PromiseInterface
2938
*/
3039
public function time();
3140

3241
/**
42+
* Rename the file and return the new file through a promise
43+
*
3344
* @param string $toFilename
34-
* @return \React\Promise\PromiseInterface
45+
* @return PromiseInterface<FileInterface>
3546
*/
3647
public function rename($toFilename);
3748

3849
/**
39-
* @return \React\Promise\PromiseInterface
50+
* Return the size of the file.
51+
*
52+
* @return PromiseInterface
4053
*/
4154
public function size();
4255

4356
/**
57+
* Create the file
58+
*
4459
* @param string $mode
4560
* @param null $time
46-
* @return \React\Promise\PromiseInterface
61+
* @return PromiseInterface
62+
*
63+
* @throws \Exception When the file already exists
4764
*/
4865
public function create($mode = AdapterInterface::CREATION_MODE, $time = null);
4966

5067
/**
68+
* Touch the file, modifying it's mtime when it exists,
69+
* or creating the file when it doesn't it exists.
70+
*
5171
* @param string $mode
5272
* @param null $time
53-
* @return \React\Promise\PromiseInterface
73+
* @return PromiseInterface
5474
*/
5575
public function touch($mode = AdapterInterface::CREATION_MODE, $time = null);
5676

5777
/**
58-
* @return PromiseInterface
78+
* Open the file and read all its contents returning those through a promise.
79+
*
80+
* @return PromiseInterface<string>
5981
*/
6082
public function getContents();
6183

6284
/**
85+
* Write the given contents to the file, overwriting any existing contents or creating the file.
86+
*
6387
* @param string $contents
6488
* @return PromiseInterface
6589
*/

0 commit comments

Comments
 (0)