xref: /PHP-8.1/ext/phar/phar_object.stub.php (revision 0d0c9aca)
1<?php
2
3/** @generate-class-entries */
4
5class PharException extends Exception
6{
7}
8
9class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess
10{
11    public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null) {}
12
13    public function __destruct() {}
14
15    /** @tentative-return-type */
16    public function addEmptyDir(string $directory): void {}
17
18    /** @tentative-return-type */
19    public function addFile(string $filename, ?string $localName = null): void {}
20
21    /** @tentative-return-type */
22    public function addFromString(string $localName, string $contents): void {}
23
24    /** @tentative-return-type */
25    public function buildFromDirectory(string $directory, string $pattern = ""): array {}
26
27    /** @tentative-return-type */
28    public function buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array {}
29
30    /** @tentative-return-type */
31    public function compressFiles(int $compression): void {}
32
33    /** @return bool */
34    public function decompressFiles() {} // TODO make return type void
35
36    /** @tentative-return-type */
37    public function compress(int $compression, ?string $extension = null): ?Phar {}
38
39    /** @tentative-return-type */
40    public function decompress(?string $extension = null): ?Phar {}
41
42    /** @tentative-return-type */
43    public function convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar {}
44
45    /** @tentative-return-type */
46    public function convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData {}
47
48    /** @return bool */
49    public function copy(string $from, string $to) {} // TODO make return type void
50
51    /** @tentative-return-type */
52    public function count(int $mode = COUNT_NORMAL): int {}
53
54    /** @return bool */
55    public function delete(string $localName) {} // TODO make return type void
56
57    /** @return bool */
58    public function delMetadata() {} // TODO make return type void
59
60    /** @tentative-return-type */
61    public function extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool {}
62
63    /** @tentative-return-type */
64    public function getAlias(): ?string {}
65
66    /** @tentative-return-type */
67    public function getPath(): string {}
68
69    /** @tentative-return-type */
70    public function getMetadata(array $unserializeOptions = []): mixed {}
71
72    /** @tentative-return-type */
73    public function getModified(): bool {}
74
75    /** @tentative-return-type */
76    public function getSignature(): array|false {}
77
78    /** @tentative-return-type */
79    public function getStub(): string {}
80
81    /** @tentative-return-type */
82    public function getVersion(): string {}
83
84    /** @tentative-return-type */
85    public function hasMetadata(): bool {}
86
87    /** @tentative-return-type */
88    public function isBuffering(): bool {}
89
90    /** @tentative-return-type */
91    public function isCompressed(): int|false {}
92
93    /** @tentative-return-type */
94    public function isFileFormat(int $format): bool {}
95
96    /** @tentative-return-type */
97    public function isWritable(): bool {}
98
99    /**
100     * @param string $localName
101     * @tentative-return-type
102     */
103    public function offsetExists($localName): bool {}
104
105    /**
106     * @param string $localName
107     * @tentative-return-type
108     */
109    public function offsetGet($localName): SplFileInfo {}
110
111    /**
112     * @param string $localName
113     * @param resource|string $value
114     * @tentative-return-type
115     */
116    public function offsetSet($localName, $value): void {}
117
118    /**
119     * @param string $localName
120     * @tentative-return-type
121     */
122    public function offsetUnset($localName): void {}
123
124    /** @tentative-return-type */
125    public function setAlias(string $alias): bool {}
126
127    /** @tentative-return-type */
128    public function setDefaultStub(?string $index = null, ?string $webIndex = null): bool {}
129
130    /** @tentative-return-type */
131    public function setMetadata(mixed $metadata): void {}
132
133    /** @tentative-return-type */
134    public function setSignatureAlgorithm(int $algo, ?string $privateKey = null): void {}
135
136    /**
137     * @param resource|string $stub
138     * @return bool
139     */
140    public function setStub($stub, int $length = UNKNOWN) {} // TODO make return type void
141
142    /** @tentative-return-type */
143    public function startBuffering(): void {}
144
145    /** @tentative-return-type */
146    public function stopBuffering(): void {}
147
148    final public static function apiVersion(): string {}
149
150    final public static function canCompress(int $compression = 0): bool {}
151
152    final public static function canWrite(): bool {}
153
154    final public static function createDefaultStub(?string $index = null, ?string $webIndex = null): string {}
155
156    final public static function getSupportedCompression(): array {}
157
158    final public static function getSupportedSignatures(): array {}
159
160    final public static function interceptFileFuncs(): void {}
161
162    final public static function isValidPharFilename(string $filename, bool $executable = true): bool {}
163
164    final public static function loadPhar(string $filename, ?string $alias = null): bool {}
165
166    final public static function mapPhar(?string $alias = null, int $offset = 0): bool {}
167
168    final public static function running(bool $returnPhar = true): string {}
169
170    final public static function mount(string $pharPath, string $externalPath): void {}
171
172    final public static function mungServer(array $variables): void {}
173
174    final public static function unlinkArchive(string $filename): bool {} // TODO make return type void
175
176    final public static function webPhar(
177        ?string $alias = null, ?string $index = null, ?string $fileNotFoundScript = null,
178        array $mimeTypes = [], ?callable $rewrite = null): void {}
179}
180
181class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess
182{
183    /**
184     * @implementation-alias Phar::__construct
185     * @no-verify PharData constructor accepts extra $format argument
186     */
187    public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $format = 0) {}
188
189    /** @implementation-alias Phar::__destruct */
190    public function __destruct() {}
191
192    /**
193     * @tentative-return-type
194     * @implementation-alias Phar::addEmptyDir
195     */
196    public function addEmptyDir(string $directory): void {}
197
198    /**
199     * @tentative-return-type
200     * @implementation-alias Phar::addFile
201     */
202    public function addFile(string $filename, ?string $localName = null): void {}
203
204    /**
205     * @tentative-return-type
206     * @implementation-alias Phar::addFromString
207     */
208    public function addFromString(string $localName, string $contents): void {}
209
210    /**
211     * @tentative-return-type
212     * @implementation-alias Phar::buildFromDirectory
213     */
214    public function buildFromDirectory(string $directory, string $pattern = ""): array {}
215
216    /**
217     * @tentative-return-type
218     * @implementation-alias Phar::buildFromIterator
219     */
220    public function buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array {}
221
222    /**
223     * @tentative-return-type
224     * @implementation-alias Phar::compressFiles
225     */
226    public function compressFiles(int $compression): void {}
227
228    /**
229     * @return bool
230     * @implementation-alias Phar::decompressFiles
231     */
232    public function decompressFiles() {} // TODO make return type void
233
234    /**
235     * @tentative-return-type
236     * @implementation-alias Phar::compress
237     * @no-verify
238     */
239    public function compress(int $compression, ?string $extension = null): ?PharData {}
240
241    /**
242     * @tentative-return-type
243     * @implementation-alias Phar::decompress
244     * @no-verify
245     */
246    public function decompress(?string $extension = null): ?PharData {}
247
248    /**
249     * @tentative-return-type
250     * @implementation-alias Phar::convertToExecutable
251     */
252    public function convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar {}
253
254    /**
255     * @tentative-return-type
256     * @implementation-alias Phar::convertToData
257     */
258    public function convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData {}
259
260    /**
261     * @return bool
262     * @implementation-alias Phar::copy
263     */
264    public function copy(string $from, string $to) {} // TODO make return type void
265
266    /**
267     * @tentative-return-type
268     * @implementation-alias Phar::count
269     */
270    public function count(int $mode = COUNT_NORMAL): int {}
271
272    /**
273     * @return bool
274     * @implementation-alias Phar::delete
275     */
276    public function delete(string $localName) {} // TODO make return type void
277
278    /**
279     * @return bool
280     * @implementation-alias Phar::delMetadata
281     */
282    public function delMetadata() {} // TODO make return type void
283
284    /**
285     * @tentative-return-type
286     * @implementation-alias Phar::extractTo
287     */
288    public function extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool {}
289
290    /**
291     * @tentative-return-type
292     * @implementation-alias Phar::getAlias
293     */
294    public function getAlias(): ?string {}
295
296    /**
297     * @tentative-return-type
298     * @implementation-alias Phar::getPath
299     */
300    public function getPath(): string {}
301
302    /**
303     * @tentative-return-type
304     * @implementation-alias Phar::getMetadata
305     */
306    public function getMetadata(array $unserializeOptions = []): mixed {}
307
308    /**
309     * @tentative-return-type
310     * @implementation-alias Phar::getModified
311     */
312    public function getModified(): bool {}
313
314    /**
315     * @tentative-return-type
316     * @implementation-alias Phar::getSignature
317     */
318    public function getSignature(): array|false {}
319
320    /**
321     * @tentative-return-type
322     * @implementation-alias Phar::getStub
323     */
324    public function getStub(): string {}
325
326    /**
327     * @tentative-return-type
328     * @implementation-alias Phar::getVersion
329     */
330    public function getVersion(): string {}
331
332    /**
333     * @tentative-return-type
334     * @implementation-alias Phar::hasMetadata
335     */
336    public function hasMetadata(): bool {}
337
338    /**
339     * @tentative-return-type
340     * @implementation-alias Phar::isBuffering
341     */
342    public function isBuffering(): bool {}
343
344    /**
345     * @tentative-return-type
346     * @implementation-alias Phar::isCompressed
347     */
348    public function isCompressed(): int|false {}
349
350    /**
351     * @tentative-return-type
352     * @implementation-alias Phar::isFileFormat
353     */
354    public function isFileFormat(int $format): bool {}
355
356    /**
357     * @tentative-return-type
358     * @implementation-alias Phar::isWritable
359     */
360    public function isWritable(): bool {}
361
362    /**
363     * @param string $localName
364     * @tentative-return-type
365     * @implementation-alias Phar::offsetExists
366     */
367    public function offsetExists($localName): bool {}
368
369    /**
370     * @param string $localName
371     * @tentative-return-type
372     * @implementation-alias Phar::offsetGet
373     */
374    public function offsetGet($localName): SplFileInfo {}
375
376    /**
377     * @param string $localName
378     * @param resource|string $value
379     * @tentative-return-type
380     * @implementation-alias Phar::offsetSet
381     */
382    public function offsetSet($localName, $value): void {}
383
384    /**
385     * @param string $localName
386     * @tentative-return-type
387     * @implementation-alias Phar::offsetUnset
388     */
389    public function offsetUnset($localName): void {}
390
391    /**
392     * @tentative-return-type
393     * @implementation-alias Phar::setAlias
394     */
395    public function setAlias(string $alias): bool {}
396
397    /**
398     * @tentative-return-type
399     * @implementation-alias Phar::setDefaultStub
400     */
401    public function setDefaultStub(?string $index = null, ?string $webIndex = null): bool {}
402
403    /**
404     * @tentative-return-type
405     * @implementation-alias Phar::setMetadata
406     */
407    public function setMetadata(mixed $metadata): void {}
408
409    /**
410     * @tentative-return-type
411     * @implementation-alias Phar::setSignatureAlgorithm
412     */
413    public function setSignatureAlgorithm(int $algo, ?string $privateKey = null): void {}
414
415    /**
416     * @param resource|string $stub
417     * @return bool
418     * @implementation-alias Phar::setStub
419     */
420    public function setStub($stub, int $length = UNKNOWN) {} // TODO make return type void
421
422    /**
423     * @tentative-return-type
424     * @implementation-alias Phar::startBuffering
425     */
426    public function startBuffering(): void {}
427
428    /**
429     * @tentative-return-type
430     * @implementation-alias Phar::stopBuffering
431     */
432    public function stopBuffering(): void {}
433
434    /** @implementation-alias Phar::apiVersion */
435    final public static function apiVersion(): string {}
436
437    /** @implementation-alias Phar::canCompress */
438    final public static function canCompress(int $compression = 0): bool {}
439
440    /** @implementation-alias Phar::canWrite */
441    final public static function canWrite(): bool {}
442
443    /** @implementation-alias Phar::createDefaultStub */
444    final public static function createDefaultStub(?string $index = null, ?string $webIndex = null): string {}
445
446    /** @implementation-alias Phar::getSupportedCompression */
447    final public static function getSupportedCompression(): array {}
448
449    /** @implementation-alias Phar::getSupportedSignatures */
450    final public static function getSupportedSignatures(): array {}
451
452    /** @implementation-alias Phar::interceptFileFuncs */
453    final public static function interceptFileFuncs(): void {}
454
455    /** @implementation-alias Phar::isValidPharFilename */
456    final public static function isValidPharFilename(string $filename, bool $executable = true): bool {}
457
458    /** @implementation-alias Phar::loadPhar */
459    final public static function loadPhar(string $filename, ?string $alias = null): bool {}
460
461    /** @implementation-alias Phar::mapPhar */
462    final public static function mapPhar(?string $alias = null, int $offset = 0): bool {}
463
464    /** @implementation-alias Phar::running */
465    final public static function running(bool $returnPhar = true): string {}
466
467    /** @implementation-alias Phar::mount */
468    final public static function mount(string $pharPath, string $externalPath): void {}
469
470    /** @implementation-alias Phar::mungServer */
471    final public static function mungServer(array $variables): void {}
472
473    /** @implementation-alias Phar::unlinkArchive */
474    final public static function unlinkArchive(string $filename): bool {} // TODO make return type void
475
476    /** @implementation-alias Phar::webPhar */
477    final public static function webPhar(
478        ?string $alias = null, ?string $index = null, ?string $fileNotFoundScript = null,
479        array $mimeTypes = [], ?callable $rewrite = null): void {}
480}
481
482class PharFileInfo extends SplFileInfo
483{
484    public function __construct(string $filename) {}
485
486    public function __destruct() {}
487
488    /** @tentative-return-type */
489    public function chmod(int $perms): void {}
490
491    /** @return bool */
492    public function compress(int $compression) {} // TODO make return type void
493
494    /** @return bool */
495    public function decompress() {} // TODO make return type void
496
497    /** @return bool */
498    public function delMetadata() {} // TODO make return type void
499
500    /** @tentative-return-type */
501    public function getCompressedSize(): int {}
502
503    /** @tentative-return-type */
504    public function getCRC32(): int {}
505
506    /** @tentative-return-type */
507    public function getContent(): string {}
508
509    /** @tentative-return-type */
510    public function getMetadata(array $unserializeOptions = []): mixed {}
511
512    /** @tentative-return-type */
513    public function getPharFlags(): int {}
514
515    /** @tentative-return-type */
516    public function hasMetadata(): bool {}
517
518    /** @tentative-return-type */
519    public function isCompressed(?int $compression = null): bool {}
520
521    /** @tentative-return-type */
522    public function isCRCChecked(): bool {}
523
524    /** @tentative-return-type */
525    public function setMetadata(mixed $metadata): void {}
526}
527