Skip to content

Generate class entries from stubs for another batch of extensions #6669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions ext/enchant/enchant.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,7 @@ static void php_enchant_dict_free(zend_object *object) /* {{{ */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(enchant)
{
zend_class_entry bce, dce;

INIT_CLASS_ENTRY(bce, "EnchantBroker", class_EnchantBroker_methods);
enchant_broker_ce = zend_register_internal_class(&bce);
enchant_broker_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
enchant_broker_ce = register_class_EnchantBroker();
enchant_broker_ce->create_object = enchant_broker_create_object;
enchant_broker_ce->serialize = zend_class_serialize_deny;
enchant_broker_ce->unserialize = zend_class_unserialize_deny;
Expand All @@ -200,9 +196,7 @@ PHP_MINIT_FUNCTION(enchant)
enchant_broker_handlers.free_obj = php_enchant_broker_free;
enchant_broker_handlers.clone_obj = NULL;

INIT_CLASS_ENTRY(dce, "EnchantDictionary", class_EnchantDictionary_methods);
enchant_dict_ce = zend_register_internal_class(&dce);
enchant_dict_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
enchant_dict_ce = register_class_EnchantDictionary();
enchant_dict_ce->create_object = enchant_dict_create_object;
enchant_dict_ce->serialize = zend_class_serialize_deny;
enchant_dict_ce->unserialize = zend_class_unserialize_deny;
Expand Down
7 changes: 6 additions & 1 deletion ext/enchant/enchant.stub.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<?php

/** @generate-function-entries */
/**
* @generate-function-entries
* @generate-class-entries
*/

/** @strict-properties */
final class EnchantBroker
{
}

/** @strict-properties */
final class EnchantDictionary
{
}
Expand Down
25 changes: 24 additions & 1 deletion ext/enchant/enchant_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 31f7c4cd39e58d6474b90acd65f4b7bda7a6ddf3 */
* Stub hash: ec1ad38320dfec1e567b0f0062dbc032c425945c */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE)
ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -157,3 +157,26 @@ static const zend_function_entry class_EnchantBroker_methods[] = {
static const zend_function_entry class_EnchantDictionary_methods[] = {
ZEND_FE_END
};

zend_class_entry *register_class_EnchantBroker()
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "EnchantBroker", class_EnchantBroker_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;

return class_entry;
}

zend_class_entry *register_class_EnchantDictionary()
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "EnchantDictionary", class_EnchantDictionary_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;

return class_entry;
}

5 changes: 4 additions & 1 deletion ext/exif/exif.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

/** @generate-function-entries */
/**
* @generate-function-entries
* @generate-class-entries
*/

function exif_tagname(int $index): string|false {}

Expand Down
3 changes: 2 additions & 1 deletion ext/exif/exif_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: ef23ff502ea9658af29e50d57366c281f7a7eb6c */
* Stub hash: 3dde1567a65ab31bd5722ea6d568050420f89439 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
Expand Down Expand Up @@ -37,3 +37,4 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(exif_imagetype, arginfo_exif_imagetype)
ZEND_FE_END
};

21 changes: 5 additions & 16 deletions ext/ffi/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4880,22 +4880,15 @@ static int zend_ffi_preload(char *preload) /* {{{ */
/* {{{ ZEND_MINIT_FUNCTION */
ZEND_MINIT_FUNCTION(ffi)
{
zend_class_entry ce;

REGISTER_INI_ENTRIES();

FFI_G(is_cli) = strcmp(sapi_module.name, "cli") == 0;

INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", NULL);
zend_ffi_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_error);
zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);

INIT_NS_CLASS_ENTRY(ce, "FFI", "ParserException", NULL);
zend_ffi_parser_exception_ce = zend_register_internal_class_ex(&ce, zend_ffi_exception_ce);
zend_ffi_parser_exception_ce->ce_flags |= ZEND_ACC_FINAL;
zend_ffi_parser_exception_ce = register_class_FFI_ParserException(zend_ffi_exception_ce);

INIT_CLASS_ENTRY(ce, "FFI", class_FFI_methods);
zend_ffi_ce = zend_register_internal_class(&ce);
zend_ffi_ce->ce_flags |= ZEND_ACC_FINAL;
zend_ffi_ce = register_class_FFI();
zend_ffi_ce->create_object = zend_ffi_new;
zend_ffi_ce->serialize = zend_class_serialize_deny;
zend_ffi_ce->unserialize = zend_class_unserialize_deny;
Expand Down Expand Up @@ -4930,9 +4923,7 @@ ZEND_MINIT_FUNCTION(ffi)

zend_declare_class_constant_long(zend_ffi_ce, "__BIGGEST_ALIGNMENT__", sizeof("__BIGGEST_ALIGNMENT__")-1, __BIGGEST_ALIGNMENT__);

INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", NULL);
zend_ffi_cdata_ce = zend_register_internal_class(&ce);
zend_ffi_cdata_ce->ce_flags |= ZEND_ACC_FINAL;
zend_ffi_cdata_ce = register_class_FFI_CData();
zend_ffi_cdata_ce->create_object = zend_ffi_cdata_new;
zend_ffi_cdata_ce->get_iterator = zend_ffi_cdata_get_iterator;
zend_ffi_cdata_ce->serialize = zend_class_serialize_deny;
Expand Down Expand Up @@ -5008,9 +4999,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_free_handlers.get_properties = zend_fake_get_properties;
zend_ffi_cdata_free_handlers.get_gc = zend_fake_get_gc;

INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_FFI_CType_methods);
zend_ffi_ctype_ce = zend_register_internal_class(&ce);
zend_ffi_ctype_ce->ce_flags |= ZEND_ACC_FINAL;
zend_ffi_ctype_ce = register_class_FFI_CType();
zend_ffi_ctype_ce->create_object = zend_ffi_ctype_new;
zend_ffi_ctype_ce->serialize = zend_class_serialize_deny;
zend_ffi_ctype_ce->unserialize = zend_class_unserialize_deny;
Expand Down
14 changes: 13 additions & 1 deletion ext/ffi/ffi.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

/** @generate-function-entries */
/**
* @generate-function-entries
* @generate-class-entries
*/

namespace {

Expand Down Expand Up @@ -68,8 +71,17 @@ public static function isNull(FFI\CData $ptr): bool {}

namespace FFI {

final class CData {
}

final class CType {
public function getName() : string {}
}

class Exception extends \Error {
}

final class ParserException extends Exception {
}

}
72 changes: 71 additions & 1 deletion ext/ffi/ffi_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 5aeec68fea7a94cd643464acfb10bf4cfcc863da */
* Stub hash: f8eb234b7efa2060f54ed300fc6fa697741b0ab6 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"")
Expand Down Expand Up @@ -125,7 +125,77 @@ static const zend_function_entry class_FFI_methods[] = {
};


static const zend_function_entry class_FFI_CData_methods[] = {
ZEND_FE_END
};


static const zend_function_entry class_FFI_CType_methods[] = {
ZEND_ME(FFI_CType, getName, arginfo_class_FFI_CType_getName, ZEND_ACC_PUBLIC)
ZEND_FE_END
};


static const zend_function_entry class_FFI_Exception_methods[] = {
ZEND_FE_END
};


static const zend_function_entry class_FFI_ParserException_methods[] = {
ZEND_FE_END
};

zend_class_entry *register_class_FFI()
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "FFI", class_FFI_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}

zend_class_entry *register_class_FFI_CData()
{
zend_class_entry ce, *class_entry;

INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", class_FFI_CData_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}

zend_class_entry *register_class_FFI_CType()
{
zend_class_entry ce, *class_entry;

INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_FFI_CType_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}

zend_class_entry *register_class_FFI_Exception(zend_class_entry *class_entry_Error)
{
zend_class_entry ce, *class_entry;

INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", class_FFI_Exception_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);

return class_entry;
}

zend_class_entry *register_class_FFI_ParserException(zend_class_entry *class_entry_FFI_Exception)
{
zend_class_entry ce, *class_entry;

INIT_NS_CLASS_ENTRY(ce, "FFI", "ParserException", class_FFI_ParserException_methods);
class_entry = zend_register_internal_class_ex(&ce, class_entry_FFI_Exception);
class_entry->ce_flags |= ZEND_ACC_FINAL;

return class_entry;
}

4 changes: 1 addition & 3 deletions ext/fileinfo/fileinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(finfo)
{
zend_class_entry _finfo_class_entry;
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", class_finfo_methods);
finfo_class_entry = zend_register_internal_class(&_finfo_class_entry);
finfo_class_entry = register_class_finfo();
finfo_class_entry->create_object = finfo_objects_new;
finfo_class_entry->serialize = zend_class_serialize_deny;
finfo_class_entry->unserialize = zend_class_unserialize_deny;
Expand Down
5 changes: 4 additions & 1 deletion ext/fileinfo/fileinfo.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

/** @generate-function-entries */
/**
* @generate-function-entries
* @generate-class-entries
*/

class finfo
{
Expand Down
13 changes: 12 additions & 1 deletion ext/fileinfo/fileinfo_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 1282a20b1d007bbcc9c0d4efe400db43a5450307 */
* Stub hash: ae5759febdd7ad434c8bf2e23e9da334ff9054dd */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_finfo_open, 0, 0, finfo, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
Expand Down Expand Up @@ -81,3 +81,14 @@ static const zend_function_entry class_finfo_methods[] = {
ZEND_ME_MAPPING(set_flags, finfo_set_flags, arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
ZEND_FE_END
};

zend_class_entry *register_class_finfo()
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "finfo", class_finfo_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);

return class_entry;
}

5 changes: 4 additions & 1 deletion ext/filter/filter.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

/** @generate-function-entries */
/**
* @generate-function-entries
* @generate-class-entries
*/

function filter_has_var(int $input_type, string $var_name): bool {}

Expand Down
3 changes: 2 additions & 1 deletion ext/filter/filter_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: b5f2e4a79eb6f30fe143b3086845435d0a0a6ef0 */
* Stub hash: dc73178b6c82437ae4eec49984613563018d3bde */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, input_type, IS_LONG, 0)
Expand Down Expand Up @@ -58,3 +58,4 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(filter_id, arginfo_filter_id)
ZEND_FE_END
};

10 changes: 9 additions & 1 deletion ext/ftp/ftp.stub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?php

/** @generate-function-entries */
/**
* @generate-function-entries
* @generate-class-entries
*/

/** @strict-properties */
final class FTPConnection
{
}

function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTPConnection|false {}

Expand Down
19 changes: 18 additions & 1 deletion ext/ftp/ftp_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 151310a13eeeb2bbf4df1ab38a3a29506b26a570 */
* Stub hash: d72294d567338c30f627b8247a8cc27148237e41 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_connect, 0, 1, FTPConnection, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
Expand Down Expand Up @@ -274,3 +274,20 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(ftp_get_option, arginfo_ftp_get_option)
ZEND_FE_END
};


static const zend_function_entry class_FTPConnection_methods[] = {
ZEND_FE_END
};

zend_class_entry *register_class_FTPConnection()
{
zend_class_entry ce, *class_entry;

INIT_CLASS_ENTRY(ce, "FTPConnection", class_FTPConnection_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;

return class_entry;
}

6 changes: 1 addition & 5 deletions ext/ftp/php_ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ static void ftp_object_destroy(zend_object *zobj) {

PHP_MINIT_FUNCTION(ftp)
{
zend_class_entry ce;

#ifdef HAVE_FTP_SSL
#if OPENSSL_VERSION_NUMBER < 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
SSL_library_init();
Expand All @@ -110,9 +108,7 @@ PHP_MINIT_FUNCTION(ftp)
#endif
#endif

INIT_CLASS_ENTRY(ce, "FTPConnection", NULL);
php_ftp_ce = zend_register_internal_class(&ce);
php_ftp_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
php_ftp_ce = register_class_FTPConnection();
php_ftp_ce->create_object = ftp_object_create;
php_ftp_ce->serialize = zend_class_serialize_deny;
php_ftp_ce->unserialize = zend_class_unserialize_deny;
Expand Down
Loading