|
4 | 4 |
|
5 | 5 | use React\Filesystem\AdapterInterface; |
6 | 6 | use React\Promise\PromiseInterface; |
| 7 | +use React\Stream\WritableStreamInterface; |
7 | 8 |
|
8 | 9 | interface FileInterface extends NodeInterface |
9 | 10 | { |
10 | 11 | /** |
11 | | - * @return \React\Promise\PromiseInterface |
| 12 | + * Returns true when the file exists |
| 13 | + * |
| 14 | + * @return PromiseInterface |
12 | 15 | */ |
13 | 16 | public function exists(); |
14 | 17 |
|
15 | 18 | /** |
16 | | - * @return \React\Promise\PromiseInterface |
| 19 | + * Remove the file |
| 20 | + * |
| 21 | + * @return PromiseInterface |
17 | 22 | */ |
18 | 23 | public function remove(); |
19 | 24 |
|
20 | 25 | /** |
| 26 | + * Open the file and return a promise resolve into a stream that can be read from or written to. |
| 27 | + * |
21 | 28 | * @param $flags |
22 | 29 | * @param string $mode |
23 | | - * @return mixed |
| 30 | + * @return PromiseInterface<GenericStreamInterface> |
24 | 31 | */ |
25 | 32 | public function open($flags, $mode = AdapterInterface::CREATION_MODE); |
26 | 33 |
|
27 | 34 | /** |
28 | | - * @return \React\Promise\PromiseInterface |
| 35 | + * Return the change time, access time, and modification time |
| 36 | + * |
| 37 | + * @return PromiseInterface |
29 | 38 | */ |
30 | 39 | public function time(); |
31 | 40 |
|
32 | 41 | /** |
| 42 | + * Rename the file and return the new file through a promise |
| 43 | + * |
33 | 44 | * @param string $toFilename |
34 | | - * @return \React\Promise\PromiseInterface |
| 45 | + * @return PromiseInterface<FileInterface> |
35 | 46 | */ |
36 | 47 | public function rename($toFilename); |
37 | 48 |
|
38 | 49 | /** |
39 | | - * @return \React\Promise\PromiseInterface |
| 50 | + * Return the size of the file. |
| 51 | + * |
| 52 | + * @return PromiseInterface |
40 | 53 | */ |
41 | 54 | public function size(); |
42 | 55 |
|
43 | 56 | /** |
| 57 | + * Create the file |
| 58 | + * |
44 | 59 | * @param string $mode |
45 | 60 | * @param null $time |
46 | | - * @return \React\Promise\PromiseInterface |
| 61 | + * @return PromiseInterface |
| 62 | + * |
| 63 | + * @throws \Exception When the file already exists |
47 | 64 | */ |
48 | 65 | public function create($mode = AdapterInterface::CREATION_MODE, $time = null); |
49 | 66 |
|
50 | 67 | /** |
| 68 | + * Touch the file, modifying it's mtime when it exists, |
| 69 | + * or creating the file when it doesn't it exists. |
| 70 | + * |
51 | 71 | * @param string $mode |
52 | 72 | * @param null $time |
53 | | - * @return \React\Promise\PromiseInterface |
| 73 | + * @return PromiseInterface |
54 | 74 | */ |
55 | 75 | public function touch($mode = AdapterInterface::CREATION_MODE, $time = null); |
56 | 76 |
|
57 | 77 | /** |
58 | | - * @return PromiseInterface |
| 78 | + * Open the file and read all its contents returning those through a promise. |
| 79 | + * |
| 80 | + * @return PromiseInterface<string> |
59 | 81 | */ |
60 | 82 | public function getContents(); |
61 | 83 |
|
62 | 84 | /** |
| 85 | + * Write the given contents to the file, overwriting any existing contents or creating the file. |
| 86 | + * |
63 | 87 | * @param string $contents |
64 | 88 | * @return PromiseInterface |
65 | 89 | */ |
|
0 commit comments