xref: /PHP-8.0/ext/spl/spl_directory.stub.php (revision 80e5ad5a)
1<?php
2
3/** @generate-function-entries */
4
5class SplFileInfo
6{
7    public function __construct(string $filename) {}
8
9    /** @return string */
10    public function getPath() {}
11
12    /** @return string */
13    public function getFilename() {}
14
15    /** @return string */
16    public function getExtension() {}
17
18    /** @return string */
19    public function getBasename(string $suffix = "") {}
20
21    /** @return string */
22    public function getPathname() {}
23
24    /** @return int|false */
25    public function getPerms() {}
26
27    /** @return int|false */
28    public function getInode() {}
29
30    /** @return int|false */
31    public function getSize() {}
32
33    /** @return int|false */
34    public function getOwner() {}
35
36    /** @return int|false */
37    public function getGroup() {}
38
39    /** @return int|false */
40    public function getATime() {}
41
42    /** @return int|false */
43    public function getMTime() {}
44
45    /** @return int|false */
46    public function getCTime() {}
47
48    /** @return string|false */
49    public function getType() {}
50
51    /** @return bool */
52    public function isWritable() {}
53
54    /** @return bool */
55    public function isReadable() {}
56
57    /** @return bool */
58    public function isExecutable() {}
59
60    /** @return bool */
61    public function isFile() {}
62
63    /** @return bool */
64    public function isDir() {}
65
66    /** @return bool */
67    public function isLink() {}
68
69    /** @return string|false */
70    public function getLinkTarget() {}
71
72    /** @return string|false */
73    public function getRealPath() {}
74
75    /** @return SplFileInfo */
76    public function getFileInfo(?string $class = null) {}
77
78    /** @return SplFileInfo|null */
79    public function getPathInfo(?string $class = null) {}
80
81    /**
82     * @param resource|null $context
83     * @return SplFileObject
84     */
85    public function openFile(string $mode = "r", bool $useIncludePath = false, $context = null) {}
86
87    /** @return void */
88    public function setFileClass(string $class = SplFileObject::class) {}
89
90    /** @return void */
91    public function setInfoClass(string $class = SplFileInfo::class) {}
92
93    /** @implementation-alias SplFileInfo::getPathname */
94    public function __toString(): string {}
95
96    /** @return array */
97    public function __debugInfo() {}
98
99    /** @return void */
100    final public function _bad_state_ex() {}
101}
102
103class DirectoryIterator extends SplFileInfo implements SeekableIterator
104{
105    public function __construct(string $directory) {}
106
107    /** @return string */
108    public function getFilename() {}
109
110    /** @return string */
111    public function getExtension() {}
112
113    /** @return string */
114    public function getBasename(string $suffix = "") {}
115
116    /** @return bool */
117    public function isDot() {}
118
119    /** @return void */
120    public function rewind() {}
121
122    /** @return bool */
123    public function valid() {}
124
125    /** @return int|false */
126    public function key() {}
127
128    /** @return DirectoryIterator */
129    public function current() {}
130
131    /** @return void */
132    public function next() {}
133
134    /** @return void */
135    public function seek(int $offset) {}
136
137    /** @implementation-alias DirectoryIterator::getFilename */
138    public function __toString(): string {}
139}
140
141class FilesystemIterator extends DirectoryIterator
142{
143    public function __construct(string $directory, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS) {}
144
145    /** @return void */
146    public function rewind() {}
147
148    /** @return string */
149    public function key() {}
150
151    /** @return string|SplFileInfo|FilesystemIterator */
152    public function current() {}
153
154    /** @return int */
155    public function getFlags() {}
156
157    /** @return void */
158    public function setFlags(int $flags) {}
159}
160
161class RecursiveDirectoryIterator extends FilesystemIterator implements RecursiveIterator
162{
163    public function __construct(string $directory, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO) {}
164
165    /** @return bool */
166    public function hasChildren(bool $allowLinks = false) {}
167
168    /** @return RecursiveDirectoryIterator */
169    public function getChildren() {}
170
171    /** @return string */
172    public function getSubPath() {}
173
174    /** @return string */
175    public function getSubPathname() {}
176}
177
178#ifdef HAVE_GLOB
179class GlobIterator extends FilesystemIterator implements Countable
180{
181    public function __construct(string $pattern, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO) {}
182
183    /** @return int */
184    public function count() {}
185}
186#endif
187
188class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator
189{
190    /** @param resource|null $context */
191    public function __construct(string $filename, string $mode = "r", bool $useIncludePath = false, $context = null) {}
192
193    /** @return void */
194    public function rewind() {}
195
196    /** @return bool */
197    public function eof() {}
198
199    /** @return bool */
200    public function valid() {}
201
202    /** @return string */
203    public function fgets() {}
204
205    /** @return string|false */
206    public function fread(int $length) {}
207
208    /** @return array|false */
209    public function fgetcsv(string $separator = ",", string $enclosure = "\"", string $escape = "\\") {}
210
211    /** @return int|false */
212    public function fputcsv(array $fields, string $separator = ",", string $enclosure = "\"", string $escape = "\\") {}
213
214    /** @return void */
215    public function setCsvControl(string $separator = ",", string $enclosure = "\"", string $escape = "\\") {}
216
217    /** @return array */
218    public function getCsvControl() {}
219
220    /**
221     * @param int $wouldBlock
222     * @return bool
223     */
224    public function flock(int $operation, &$wouldBlock = null) {}
225
226    /** @return bool */
227    public function fflush() {}
228
229    /** @return int|false */
230    public function ftell() {}
231
232    /** @return int */
233    public function fseek(int $offset, int $whence = SEEK_SET) {}
234
235    /** @return string|false */
236    public function fgetc() {}
237
238    /** @return int */
239    public function fpassthru() {}
240
241    /** @return array|int|null */
242    public function fscanf(string $format, mixed &...$vars) {}
243
244    /** @return int|false */
245    public function fwrite(string $data, int $length = 0) {}
246
247    /** @return array */
248    public function fstat() {}
249
250    /** @return bool */
251    public function ftruncate(int $size) {}
252
253    /** @return string|array|false */
254    public function current() {}
255
256    /** @return int */
257    public function key() {}
258
259    /** @return void */
260    public function next() {}
261
262    /** @return void */
263    public function setFlags(int $flags) {}
264
265    /** @return int */
266    public function getFlags() {}
267
268    /** @return void */
269    public function setMaxLineLen(int $maxLength) {}
270
271    /** @return int */
272    public function getMaxLineLen() {}
273
274    /** @return bool */
275    public function hasChildren() {}
276
277    /** @return RecursiveIterator|null */
278    public function getChildren() {}
279
280    /** @return void */
281    public function seek(int $line) {}
282
283    /**
284     * @return string
285     * @alias SplFileObject::fgets
286     */
287    public function getCurrentLine() {}
288
289    /** @implementation-alias SplFileObject::fgets */
290    public function __toString(): string {}
291}
292
293class SplTempFileObject extends SplFileObject
294{
295    public function __construct(int $maxMemory = 2 * 1024 * 1024) {}
296}
297