forked from JetBrains/phpstorm-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileinfo.php
255 lines (230 loc) · 8.22 KB
/
fileinfo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<?php
// Start of fileinfo v.1.0.5
use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;
use JetBrains\PhpStorm\Internal\TentativeType;
use JetBrains\PhpStorm\Pure;
class finfo
{
/**
* @param int $flags [optional]
* @param string $magic_database [optional]
*/
public function __construct(
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $flags = 0,
#[LanguageLevelTypeAware(['8.0' => 'string|null'], default: '')] $magic_database
) {}
/**
* @param $options [optional]
* @param $arg [optional]
*/
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')]
public function finfo($options, $arg) {}
/**
* (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Set libmagic configuration options
* @link https://php.net/manual/en/function.finfo-set-flags.php
* @param int $flags <p>
* One or disjunction of more Fileinfo
* constants.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function set_flags(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $flags) {}
/**
* (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Return information about a file
* @link https://php.net/manual/en/function.finfo-file.php
* @param string $filename <p>
* Name of a file to be checked.
* </p>
* @param int $flags [optional] <p>
* One or disjunction of more Fileinfo
* constants.
* </p>
* @param resource $context [optional] <p>
* For a description of contexts, refer to .
* </p>
* @return string a textual description of the contents of the
* <i>filename</i> argument, or <b>FALSE</b> if an error occurred.
*/
#[Pure]
#[TentativeType]
public function file(
#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $filename,
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $flags = FILEINFO_NONE,
$context = null
): string|false {}
/**
* (PHP 5 >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Return information about a string buffer
* @link https://php.net/manual/en/function.finfo-buffer.php
* @param string $string <p>
* Content of a file to be checked.
* </p>
* @param int $flags [optional] <p>
* One or disjunction of more Fileinfo
* constants.
* </p>
* @param resource $context [optional]
* @return string a textual description of the <i>string</i>
* argument, or <b>FALSE</b> if an error occurred.
*/
#[Pure]
#[TentativeType]
public function buffer(
#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $string,
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $flags = FILEINFO_NONE,
$context = null
): string|false {}
}
/**
* (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Create a new fileinfo resource
* @link https://php.net/manual/en/function.finfo-open.php
* @param int $flags <p>
* One or disjunction of more Fileinfo
* constants.
* </p>
* @param string|null $magic_database [optional] <p>
* Name of a magic database file, usually something like
* /path/to/magic.mime. If not specified,
* the MAGIC environment variable is used. If this variable
* is not set either, /usr/share/misc/magic is used by default.
* A .mime and/or .mgc suffix is added if
* needed.
* </p>
* @return resource|false a magic database resource on success or <b>FALSE</b> on failure.
*/
#[LanguageLevelTypeAware(['8.1' => 'finfo|false'], default: 'resource|false')]
function finfo_open(int $flags = 0, ?string $magic_database = null) {}
/**
* (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Close fileinfo resource
* @link https://php.net/manual/en/function.finfo-close.php
* @param resource $finfo <p>
* Fileinfo resource returned by finfo_open.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function finfo_close(#[LanguageLevelTypeAware(['8.1' => 'finfo'], default: 'resource')] $finfo): bool {}
/**
* (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Set libmagic configuration options
* @link https://php.net/manual/en/function.finfo-set-flags.php
* @param resource $finfo <p>
* Fileinfo resource returned by finfo_open.
* </p>
* @param int $flags <p>
* One or disjunction of more Fileinfo
* constants.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function finfo_set_flags(#[LanguageLevelTypeAware(['8.1' => 'finfo'], default: 'resource')] $finfo, int $flags): bool {}
/**
* (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Return information about a file
* @link https://php.net/manual/en/function.finfo-file.php
* @param resource $finfo <p>
* Fileinfo resource returned by finfo_open.
* </p>
* @param string $filename <p>
* Name of a file to be checked.
* </p>
* @param int $flags <p>
* One or disjunction of more Fileinfo
* constants.
* </p>
* @param resource $context [optional] <p>
* For a description of contexts, refer to .
* </p>
* @return string|false a textual description of the contents of the
* <i>filename</i> argument, or <b>FALSE</b> if an error occurred.
*/
function finfo_file(#[LanguageLevelTypeAware(['8.1' => 'finfo'], default: 'resource')] $finfo, string $filename, int $flags = 0, $context): string|false {}
/**
* (PHP 5 >= 5.3.0, PECL fileinfo >= 0.1.0)<br/>
* Return information about a string buffer
* @link https://php.net/manual/en/function.finfo-buffer.php
* @param resource $finfo <p>
* Fileinfo resource returned by finfo_open.
* </p>
* @param string $string <p>
* Content of a file to be checked.
* </p>
* @param int $flags [optional] One or disjunction of more
* <a href="https://php.net/manual/en/fileinfo.constants.php">Fileinfo</a> constants.
* @param resource $context [optional]
* @return string|false a textual description of the <i>string</i>
* argument, or <b>FALSE</b> if an error occurred.
*/
function finfo_buffer(#[LanguageLevelTypeAware(['8.1' => 'finfo'], default: 'resource')] $finfo, string $string, int $flags = FILEINFO_NONE, $context): string|false {}
/**
* Detect MIME Content-type for a file
* @link https://php.net/manual/en/function.mime-content-type.php
* @param string $filename <p>
* Path to the tested file.
* </p>
* @return string|false the content type in MIME format, like
* text/plain or application/octet-stream.
*/
function mime_content_type($filename): string|false {}
/**
* No special handling.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_NONE', 0);
/**
* Follow symlinks.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_SYMLINK', 2);
/**
* Return the mime type and mime encoding as defined by RFC 2045.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_MIME', 1040);
/**
* Return the mime type.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_MIME_TYPE', 16);
/**
* Return the mime encoding of the file.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_MIME_ENCODING', 1024);
/**
* Look at the contents of blocks or character special devices.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_DEVICES', 8);
/**
* Return all matches, not just the first.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_CONTINUE', 32);
/**
* If possible preserve the original access time.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_PRESERVE_ATIME', 128);
/**
* Don't translate unprintable characters to a \ooo octal
* representation.
* @link https://php.net/manual/en/fileinfo.constants.php
*/
define('FILEINFO_RAW', 256);
/**
* Returns the file extension appropriate for a the MIME type detected in the file.
* For types that commonly have multiple file extensions, such as JPEG images, then the return value is multiple extensions speparated by a forward slash e.g.: "jpeg/jpg/jpe/jfif".
* For unknown types not available in the magic.mime database, then return value is "???". Available since PHP 7.2.0.
* @since 7.2
*/
define('FILEINFO_EXTENSION', 2097152);
/**
* @since 8.2
*/
define('FILEINFO_APPLE', 2048);
// End of fileinfo v.1.0.5