xref: /PHP-8.3/ext/fileinfo/fileinfo.stub.php (revision e328c683)
1<?php
2
3/** @generate-class-entries */
4
5/**
6 * @var int
7 * @cvalue MAGIC_NONE
8 */
9const FILEINFO_NONE = UNKNOWN;
10/**
11 * @var int
12 * @cvalue MAGIC_SYMLINK
13 */
14const FILEINFO_SYMLINK = UNKNOWN;
15/**
16 * @var int
17 * @cvalue MAGIC_MIME
18 */
19const FILEINFO_MIME = UNKNOWN;
20/**
21 * @var int
22 * @cvalue MAGIC_MIME_TYPE
23 */
24const FILEINFO_MIME_TYPE = UNKNOWN;
25/**
26 * @var int
27 * @cvalue MAGIC_MIME_ENCODING
28 */
29const FILEINFO_MIME_ENCODING = UNKNOWN;
30/**
31 * @var int
32 * @cvalue MAGIC_DEVICES
33 */
34const FILEINFO_DEVICES = UNKNOWN;
35/**
36 * @var int
37 * @cvalue MAGIC_CONTINUE
38 */
39const FILEINFO_CONTINUE = UNKNOWN;
40#ifdef MAGIC_PRESERVE_ATIME
41/**
42 * @var int
43 * @cvalue MAGIC_PRESERVE_ATIME
44 */
45const FILEINFO_PRESERVE_ATIME = UNKNOWN;
46#endif
47#ifdef MAGIC_RAW
48/**
49 * @var int
50 * @cvalue MAGIC_RAW
51 */
52const FILEINFO_RAW = UNKNOWN;
53#endif
54/**
55 * @var int
56 * @cvalue MAGIC_APPLE
57 */
58const FILEINFO_APPLE = UNKNOWN;
59/**
60 * @var int
61 * @cvalue MAGIC_EXTENSION
62 */
63const FILEINFO_EXTENSION = UNKNOWN;
64
65/** @not-serializable */
66class finfo
67{
68    /** @alias finfo_open */
69    public function __construct(int $flags = FILEINFO_NONE, ?string $magic_database = null) {}
70
71    /**
72     * @param resource|null $context
73     * @tentative-return-type
74     * @alias finfo_file
75     */
76    public function file(string $filename, int $flags = FILEINFO_NONE, $context = null): string|false {}
77
78    /**
79     * @param resource|null $context
80     * @tentative-return-type
81     * @alias finfo_buffer
82     */
83    public function buffer(string $string, int $flags = FILEINFO_NONE, $context = null): string|false {}
84
85    /**
86     * @return bool
87     * @alias finfo_set_flags
88     */
89    public function set_flags(int $flags) {} // TODO make return type void
90}
91
92/** @refcount 1 */
93function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): finfo|false {}
94
95function finfo_close(finfo $finfo): bool {}
96
97function finfo_set_flags(finfo $finfo, int $flags): bool {} // TODO make return type void
98
99/**
100 * @param resource|null $context
101 * @refcount 1
102 */
103function finfo_file(finfo $finfo, string $filename, int $flags = FILEINFO_NONE, $context = null): string|false {}
104
105/**
106 * @param resource|null $context
107 * @refcount 1
108 */
109function finfo_buffer(finfo $finfo, string $string, int $flags = FILEINFO_NONE, $context = null): string|false {}
110
111/**
112 * @param resource|string $filename
113 * @refcount 1
114 */
115function mime_content_type($filename): string|false {}
116