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