xref: /PHP-8.1/ext/session/session.stub.php (revision 50f31829)
1<?php
2
3/** @generate-class-entries */
4
5/** @refcount 1 */
6function session_name(?string $name = null): string|false {}
7
8/** @refcount 1 */
9function session_module_name(?string $module = null): string|false {}
10
11/** @refcount 1 */
12function session_save_path(?string $path = null): string|false {}
13
14function session_id(?string $id = null): string|false {}
15
16/** @refcount 1 */
17function session_create_id(string $prefix = ""): string|false {}
18
19function session_regenerate_id(bool $delete_old_session = false): bool {}
20
21function session_decode(string $data): bool {}
22
23/** @refcount 1 */
24function session_encode(): string|false {}
25
26function session_destroy(): bool {}
27
28function session_unset(): bool {}
29
30function session_gc(): int|false {}
31
32/**
33 * @return array<string, mixed>
34 * @refcount 1
35 */
36function session_get_cookie_params(): array {}
37
38function session_write_close(): bool {}
39
40function session_abort(): bool {}
41
42function session_reset(): bool {}
43
44function session_status(): int {}
45
46function session_register_shutdown(): void {}
47
48/** @alias session_write_close */
49function session_commit(): bool {}
50
51/**
52 * @param callable|object $open
53 * @param callable|bool $close
54 */
55function session_set_save_handler(
56    $open,
57    $close = UNKNOWN,
58    callable $read = UNKNOWN,
59    callable $write = UNKNOWN,
60    callable $destroy = UNKNOWN,
61    callable $gc = UNKNOWN,
62    callable $create_sid = UNKNOWN,
63    callable $validate_sid = UNKNOWN,
64    callable $update_timestamp = UNKNOWN
65): bool {}
66
67/** @refcount 1 */
68function session_cache_limiter(?string $value = null): string|false {}
69
70function session_cache_expire(?int $value = null): int|false {}
71
72function session_set_cookie_params(array|int $lifetime_or_options, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httponly = null): bool {}
73
74function session_start(array $options = []): bool {}
75
76interface SessionHandlerInterface
77{
78    /** @tentative-return-type */
79    public function open(string $path, string $name): bool;
80
81    /** @tentative-return-type */
82    public function close(): bool;
83
84    /** @tentative-return-type */
85    public function read(string $id): string|false;
86
87    /** @tentative-return-type */
88    public function write(string $id, string $data): bool;
89
90    /** @tentative-return-type */
91    public function destroy(string $id): bool;
92
93    /** @tentative-return-type */
94    public function gc(int $max_lifetime): int|false;
95}
96
97interface SessionIdInterface
98{
99    /** @tentative-return-type */
100    public function create_sid(): string;
101}
102
103interface SessionUpdateTimestampHandlerInterface
104{
105    /** @tentative-return-type */
106    public function validateId(string $id): bool;
107
108    /** @tentative-return-type */
109    public function updateTimestamp(string $id, string $data): bool;
110}
111
112class SessionHandler implements SessionHandlerInterface, SessionIdInterface
113{
114    /** @tentative-return-type */
115    public function open(string $path, string $name): bool {}
116
117    /** @tentative-return-type */
118    public function close(): bool {}
119
120    /** @tentative-return-type */
121    public function read(string $id): string|false {}
122
123    /** @tentative-return-type */
124    public function write(string $id, string $data): bool {}
125
126    /** @tentative-return-type */
127    public function destroy(string $id): bool {}
128
129    /** @tentative-return-type */
130    public function gc(int $max_lifetime): int|false {}
131
132    /** @tentative-return-type */
133    public function create_sid(): string {}
134}
135