Skip to content

Commit 8bd0b4a

Browse files
committed
poll: make Handle::getFileDescriptor abstract
1 parent dc190e3 commit 8bd0b4a

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

ext/standard/io_poll.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -435,20 +435,6 @@ PHP_METHOD(Io_Poll_Backend, supportsEdgeTriggering)
435435
RETURN_BOOL(php_poll_backend_supports_edge_triggering(type));
436436
}
437437

438-
PHP_METHOD(Io_Poll_Handle, getFileDescriptor)
439-
{
440-
ZEND_PARSE_PARAMETERS_NONE();
441-
442-
php_poll_handle_object *intern = PHP_POLL_HANDLE_OBJ_FROM_ZV(getThis());
443-
php_socket_t fd = php_poll_handle_get_fd(intern);
444-
445-
if (fd == SOCK_ERR) {
446-
RETURN_LONG(0);
447-
}
448-
449-
RETURN_LONG((zend_long) fd);
450-
}
451-
452438
PHP_METHOD(StreamPollHandle, __construct)
453439
{
454440
php_stream *stream;
@@ -491,6 +477,20 @@ PHP_METHOD(StreamPollHandle, isValid)
491477
RETURN_BOOL(intern->ops->is_valid(intern));
492478
}
493479

480+
PHP_METHOD(StreamPollHandle, getFileDescriptor)
481+
{
482+
ZEND_PARSE_PARAMETERS_NONE();
483+
484+
php_poll_handle_object *intern = PHP_POLL_HANDLE_OBJ_FROM_ZV(getThis());
485+
php_socket_t fd = php_poll_handle_get_fd(intern);
486+
487+
if (fd == SOCK_ERR) {
488+
RETURN_LONG(0);
489+
}
490+
491+
RETURN_LONG((zend_long) fd);
492+
}
493+
494494
PHP_METHOD(Io_Poll_Watcher, __construct)
495495
{
496496
zend_throw_error(NULL, "Cannot directly construct Watcher, use Context::add");

ext/standard/io_poll.stub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum Event {
3636

3737
abstract class Handle
3838
{
39-
protected function getFileDescriptor(): int {}
39+
abstract protected function getFileDescriptor(): int;
4040
}
4141

4242
final class Watcher
@@ -141,5 +141,7 @@ public function __construct($stream) {}
141141
public function getStream() {}
142142

143143
public function isValid(): bool {}
144+
145+
protected function getFileDescriptor(): int {}
144146
}
145147
}

ext/standard/io_poll_arginfo.h

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

0 commit comments

Comments
 (0)