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