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