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