Skip to content

Commit 22689ad

Browse files
committed
poll: make PollWatcher::__construct private
1 parent efce95d commit 22689ad

File tree

3 files changed

+5
-32
lines changed

3 files changed

+5
-32
lines changed

ext/standard/poll.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -295,30 +295,7 @@ PHP_METHOD(StreamPollHandle, isValid)
295295

296296
PHP_METHOD(PollWatcher, __construct)
297297
{
298-
zval *handle_obj;
299-
zend_long events;
300-
zval *data = NULL;
301-
302-
ZEND_PARSE_PARAMETERS_START(2, 3)
303-
Z_PARAM_OBJECT_OF_CLASS(handle_obj, php_poll_handle_class_entry)
304-
Z_PARAM_LONG(events)
305-
Z_PARAM_OPTIONAL
306-
Z_PARAM_ZVAL(data)
307-
ZEND_PARSE_PARAMETERS_END();
308-
309-
php_poll_watcher_object *intern = PHP_POLL_WATCHER_OBJ_FROM_ZV(getThis());
310-
intern->handle = PHP_POLL_HANDLE_OBJ_FROM_ZV(handle_obj);
311-
intern->watched_events = (uint32_t) events;
312-
intern->triggered_events = 0;
313-
intern->active = false;
314-
315-
GC_ADDREF(&intern->handle->std);
316-
317-
if (data) {
318-
ZVAL_COPY(&intern->data, data);
319-
} else {
320-
ZVAL_NULL(&intern->data);
321-
}
298+
zend_throw_error(NULL, "Cannot directly construct PollWatcher, use PollContext::add");
322299
}
323300

324301
PHP_METHOD(PollWatcher, getHandle)

ext/standard/poll.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function isValid(): bool {}
6666

6767
final class PollWatcher
6868
{
69-
public function __construct(PollHandle $handle, int $events, mixed $data = null) {}
69+
private final function __construct() {}
7070

7171
public function getHandle(): PollHandle {}
7272

ext/standard/poll_arginfo.h

Lines changed: 3 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)