-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Expand file tree
/
Copy pathio_poll.stub.php
More file actions
167 lines (119 loc) · 4.25 KB
/
Copy pathio_poll.stub.php
File metadata and controls
167 lines (119 loc) · 4.25 KB
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
<?php
/**
* @generate-class-entries
* @generate-c-enums
*/
namespace Io {
class IoException extends \Exception {}
}
namespace Io\Poll {
// Keep in sync with main/php_poll.h!
enum Backend
{
case Auto;
case Poll;
case Epoll;
case Kqueue;
case EventPorts;
case WSAPoll;
/** @return list<Backend> */
static public function getAvailableBackends(): array {}
public function isAvailable(): bool {}
public function supportsEdgeTriggering(): bool {}
}
// Keep in sync with main/php_poll.h!
enum Event {
case Read;
case Write;
case Error;
case HangUp;
case ReadHangUp;
case OneShot;
case EdgeTriggered;
}
interface Handle
{
}
/**
* @strict-properties
* @not-serializable
*/
final class Watcher
{
private final function __construct() {}
public function getHandle(): Handle {}
/** @return list<Event> */
public function getWatchedEvents(): array {}
/** @return list<Event> */
public function getTriggeredEvents(): array {}
public function getData(): mixed {}
public function hasTriggered(Event $event): bool {}
public function isActive(): bool {}
public function modify(array $events, mixed $data = null): void {}
public function modifyEvents(array $events): void {}
public function modifyData(mixed $data): void {}
public function remove(): void {}
}
/**
* @strict-properties
* @not-serializable
*/
final class Context
{
public function __construct(Backend $backend = Backend::Auto) {}
public function add(Handle $handle, array $events, mixed $data = null): Watcher {}
/** @return list<Watcher> */
public function wait(?int $timeoutSeconds = null, int $timeoutMicroseconds = 0, ?int $maxEvents = null): array {}
public function getBackend(): Backend {}
}
class PollException extends \Io\IoException {}
abstract class FailedPollOperationException extends PollException
{
/** @cvalue PHP_POLL_ERROR_CODE_NONE */
public const int ERROR_NONE = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_SYSTEM */
public const int ERROR_SYSTEM = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_NOMEM */
public const int ERROR_NOMEM = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_INVALID */
public const int ERROR_INVALID = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_EXISTS */
public const int ERROR_EXISTS = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_NOTFOUND */
public const int ERROR_NOTFOUND = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_TIMEOUT */
public const int ERROR_TIMEOUT = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_INTERRUPTED */
public const int ERROR_INTERRUPTED = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_PERMISSION */
public const int ERROR_PERMISSION = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_TOOBIG */
public const int ERROR_TOOBIG = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_AGAIN */
public const int ERROR_AGAIN = UNKNOWN;
/** @cvalue PHP_POLL_ERROR_CODE_NOSUPPORT */
public const int ERROR_NOSUPPORT = UNKNOWN;
}
class FailedContextInitializationException extends FailedPollOperationException {}
class FailedHandleAddException extends FailedPollOperationException {}
class FailedWatcherModificationException extends FailedPollOperationException {}
class FailedPollWaitException extends FailedPollOperationException {}
class BackendUnavailableException extends PollException {}
class InactiveWatcherException extends PollException {}
class HandleAlreadyWatchedException extends PollException {}
class InvalidHandleException extends PollException {}
}
namespace {
/**
* @strict-properties
* @not-serializable
*/
final class StreamPollHandle implements Io\Poll\Handle
{
/** @param resource $stream */
public function __construct($stream) {}
/** @return resource|null */
public function getStream() {}
public function isValid(): bool {}
}
}