xref: /PHP-8.1/ext/zip/php_zip.stub.php (revision 62a650ab)
1<?php
2
3/** @generate-class-entries */
4
5/**
6 * @return resource|int|false
7 * @deprecated
8 */
9function zip_open(string $filename) {}
10
11/**
12 * @param resource $zip
13 * @deprecated
14 */
15function zip_close($zip): void {}
16
17/**
18 * @param resource $zip
19 * @return resource|false
20 * @deprecated
21 */
22function zip_read($zip) {}
23
24/**
25 * @param resource $zip_dp
26 * @param resource $zip_entry
27 * @deprecated
28 */
29function zip_entry_open($zip_dp, $zip_entry, string $mode = "rb"): bool {}
30
31/**
32 * @param resource $zip_entry
33 * @deprecated
34 */
35function zip_entry_close($zip_entry): bool {}
36
37/**
38 * @param resource $zip_entry
39 * @deprecated
40 */
41function zip_entry_read($zip_entry, int $len = 1024): string|false {}
42
43/**
44 * @param resource $zip_entry
45 * @deprecated
46 */
47function zip_entry_name($zip_entry): string|false {}
48
49/**
50 * @param resource $zip_entry
51 * @deprecated
52 */
53function zip_entry_compressedsize($zip_entry): int|false {}
54
55/**
56 * @param resource $zip_entry
57 * @deprecated
58 */
59function zip_entry_filesize($zip_entry): int|false {}
60
61/**
62 * @param resource $zip_entry
63 * @deprecated
64 */
65function zip_entry_compressionmethod($zip_entry): string|false {}
66
67class ZipArchive implements Countable
68{
69    /** @readonly */
70    public int $lastId;
71    /** @readonly */
72    public int $status;
73    /** @readonly */
74    public int $statusSys;
75    /** @readonly */
76    public int $numFiles;
77    /** @readonly */
78    public string $filename;
79    /** @readonly */
80    public string $comment;
81
82    /** @tentative-return-type */
83    public function open(string $filename, int $flags = 0): bool|int {}
84
85    /** @tentative-return-type */
86    public function setPassword(string $password): bool {}
87
88    /** @tentative-return-type */
89    public function close(): bool {}
90
91    /** @tentative-return-type */
92    public function count(): int {}
93
94    /** @tentative-return-type */
95    public function getStatusString(): string {}
96
97    /** @tentative-return-type */
98    public function addEmptyDir(string $dirname, int $flags = 0): bool {}
99
100    /** @tentative-return-type */
101    public function addFromString(string $name, string $content, int $flags = ZipArchive::FL_OVERWRITE): bool {}
102
103    /** @tentative-return-type */
104    public function addFile(string $filepath, string $entryname = "", int $start = 0, int $length = 0, int $flags = ZipArchive::FL_OVERWRITE): bool {}
105
106    /** @tentative-return-type */
107    public function replaceFile(string $filepath, int $index, int $start = 0, int $length = 0, int $flags = 0): bool {}
108
109    /** @tentative-return-type */
110    public function addGlob(string $pattern, int $flags = 0, array $options = []): array|false {}
111
112    /** @tentative-return-type */
113    public function addPattern(string $pattern, string $path = ".", array $options = []): array|false {}
114
115    /** @tentative-return-type */
116    public function renameIndex(int $index, string $new_name): bool {}
117
118    /** @tentative-return-type */
119    public function renameName(string $name, string $new_name): bool {}
120
121    /** @tentative-return-type */
122    public function setArchiveComment(string $comment): bool {}
123
124    /** @tentative-return-type */
125    public function getArchiveComment(int $flags = 0): string|false {}
126
127    /** @tentative-return-type */
128    public function setCommentIndex(int $index, string $comment): bool {}
129
130    /** @tentative-return-type */
131    public function setCommentName(string $name, string $comment): bool {}
132
133#ifdef HAVE_SET_MTIME
134    /** @tentative-return-type */
135    public function setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool {}
136
137    /** @tentative-return-type */
138    public function setMtimeName(string $name, int $timestamp, int $flags = 0): bool {}
139#endif
140
141    /** @tentative-return-type */
142    public function getCommentIndex(int $index, int $flags = 0): string|false {}
143
144    /** @tentative-return-type */
145    public function getCommentName(string $name, int $flags = 0): string|false {}
146
147    /** @tentative-return-type */
148    public function deleteIndex(int $index): bool {}
149
150    /** @tentative-return-type */
151    public function deleteName(string $name): bool {}
152
153    /** @tentative-return-type */
154    public function statName(string $name, int $flags = 0): array|false {}
155
156    /** @tentative-return-type */
157    public function statIndex(int $index, int $flags = 0): array|false {}
158
159    /** @tentative-return-type */
160    public function locateName(string $name, int $flags = 0): int|false {}
161
162    /** @tentative-return-type */
163    public function getNameIndex(int $index, int $flags = 0): string|false {}
164
165    /** @tentative-return-type */
166    public function unchangeArchive(): bool {}
167
168    /** @tentative-return-type */
169    public function unchangeAll(): bool {}
170
171    /** @tentative-return-type */
172    public function unchangeIndex(int $index): bool {}
173
174    /** @tentative-return-type */
175    public function unchangeName(string $name): bool {}
176
177    /** @tentative-return-type */
178    public function extractTo(string $pathto, array|string|null $files = null): bool {}
179
180    /** @tentative-return-type */
181    public function getFromName(string $name, int $len = 0, int $flags = 0): string|false {}
182
183    /** @tentative-return-type */
184    public function getFromIndex(int $index, int $len = 0, int $flags = 0): string|false {}
185
186    /** @return resource|false */
187    public function getStream(string $name) {}
188
189#ifdef ZIP_OPSYS_DEFAULT
190    /** @tentative-return-type */
191    public function setExternalAttributesName(string $name, int $opsys, int $attr, int $flags = 0): bool {}
192
193    /** @tentative-return-type */
194    public function setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0): bool {}
195
196    /**
197     * @param int $opsys
198     * @param int $attr
199     * @tentative-return-type
200     */
201    public function getExternalAttributesName(string $name, &$opsys, &$attr, int $flags = 0): bool {}
202
203    /**
204     * @param int $opsys
205     * @param int $attr
206     * @tentative-return-type
207     */
208    public function getExternalAttributesIndex(int $index, &$opsys, &$attr, int $flags = 0): bool {}
209#endif
210
211    /** @tentative-return-type */
212    public function setCompressionName(string $name, int $method, int $compflags = 0): bool {}
213
214    /** @tentative-return-type */
215    public function setCompressionIndex(int $index, int $method, int $compflags = 0): bool {}
216
217#ifdef HAVE_ENCRYPTION
218    /** @tentative-return-type */
219    public function setEncryptionName(string $name, int $method, ?string $password = null): bool {}
220
221    /** @tentative-return-type */
222    public function setEncryptionIndex(int $index, int $method, ?string $password = null): bool {}
223#endif
224
225#ifdef HAVE_PROGRESS_CALLBACK
226    /** @tentative-return-type */
227    public function registerProgressCallback(float $rate, callable $callback): bool {}
228#endif
229
230#ifdef HAVE_CANCEL_CALLBACK
231    /** @tentative-return-type */
232    public function registerCancelCallback(callable $callback): bool {}
233#endif
234
235#ifdef HAVE_METHOD_SUPPORTED
236    public static function isCompressionMethodSupported(int $method, bool $enc = true): bool {}
237
238    public static function isEncryptionMethodSupported(int $method, bool $enc = true): bool {}
239#endif
240}
241