Skip to content

Commit 98fb565

Browse files
committed
Generate class entries from stubs for another batch of extensions
Closes GH-6669
1 parent 882b418 commit 98fb565

35 files changed

+314
-86
lines changed

ext/enchant/enchant.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,7 @@ static void php_enchant_dict_free(zend_object *object) /* {{{ */
186186
/* {{{ PHP_MINIT_FUNCTION */
187187
PHP_MINIT_FUNCTION(enchant)
188188
{
189-
zend_class_entry bce, dce;
190-
191-
INIT_CLASS_ENTRY(bce, "EnchantBroker", class_EnchantBroker_methods);
192-
enchant_broker_ce = zend_register_internal_class(&bce);
193-
enchant_broker_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
189+
enchant_broker_ce = register_class_EnchantBroker();
194190
enchant_broker_ce->create_object = enchant_broker_create_object;
195191
enchant_broker_ce->serialize = zend_class_serialize_deny;
196192
enchant_broker_ce->unserialize = zend_class_unserialize_deny;
@@ -200,9 +196,7 @@ PHP_MINIT_FUNCTION(enchant)
200196
enchant_broker_handlers.free_obj = php_enchant_broker_free;
201197
enchant_broker_handlers.clone_obj = NULL;
202198

203-
INIT_CLASS_ENTRY(dce, "EnchantDictionary", class_EnchantDictionary_methods);
204-
enchant_dict_ce = zend_register_internal_class(&dce);
205-
enchant_dict_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
199+
enchant_dict_ce = register_class_EnchantDictionary();
206200
enchant_dict_ce->create_object = enchant_dict_create_object;
207201
enchant_dict_ce->serialize = zend_class_serialize_deny;
208202
enchant_dict_ce->unserialize = zend_class_unserialize_deny;

ext/enchant/enchant.stub.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/**
4+
* @generate-function-entries
5+
* @generate-class-entries
6+
*/
47

8+
/** @strict-properties */
59
final class EnchantBroker
610
{
711
}
812

13+
/** @strict-properties */
914
final class EnchantDictionary
1015
{
1116
}

ext/enchant/enchant_arginfo.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 31f7c4cd39e58d6474b90acd65f4b7bda7a6ddf3 */
2+
* Stub hash: ec1ad38320dfec1e567b0f0062dbc032c425945c */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE)
55
ZEND_END_ARG_INFO()
@@ -157,3 +157,26 @@ static const zend_function_entry class_EnchantBroker_methods[] = {
157157
static const zend_function_entry class_EnchantDictionary_methods[] = {
158158
ZEND_FE_END
159159
};
160+
161+
zend_class_entry *register_class_EnchantBroker()
162+
{
163+
zend_class_entry ce, *class_entry;
164+
165+
INIT_CLASS_ENTRY(ce, "EnchantBroker", class_EnchantBroker_methods);
166+
class_entry = zend_register_internal_class_ex(&ce, NULL);
167+
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
168+
169+
return class_entry;
170+
}
171+
172+
zend_class_entry *register_class_EnchantDictionary()
173+
{
174+
zend_class_entry ce, *class_entry;
175+
176+
INIT_CLASS_ENTRY(ce, "EnchantDictionary", class_EnchantDictionary_methods);
177+
class_entry = zend_register_internal_class_ex(&ce, NULL);
178+
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
179+
180+
return class_entry;
181+
}
182+

ext/exif/exif.stub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/**
4+
* @generate-function-entries
5+
* @generate-class-entries
6+
*/
47

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

ext/exif/exif_arginfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: ef23ff502ea9658af29e50d57366c281f7a7eb6c */
2+
* Stub hash: 3dde1567a65ab31bd5722ea6d568050420f89439 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
@@ -37,3 +37,4 @@ static const zend_function_entry ext_functions[] = {
3737
ZEND_FE(exif_imagetype, arginfo_exif_imagetype)
3838
ZEND_FE_END
3939
};
40+

ext/ffi/ffi.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4880,22 +4880,15 @@ static int zend_ffi_preload(char *preload) /* {{{ */
48804880
/* {{{ ZEND_MINIT_FUNCTION */
48814881
ZEND_MINIT_FUNCTION(ffi)
48824882
{
4883-
zend_class_entry ce;
4884-
48854883
REGISTER_INI_ENTRIES();
48864884

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

4889-
INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", NULL);
4890-
zend_ffi_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_error);
4887+
zend_ffi_exception_ce = register_class_FFI_Exception(zend_ce_error);
48914888

4892-
INIT_NS_CLASS_ENTRY(ce, "FFI", "ParserException", NULL);
4893-
zend_ffi_parser_exception_ce = zend_register_internal_class_ex(&ce, zend_ffi_exception_ce);
4894-
zend_ffi_parser_exception_ce->ce_flags |= ZEND_ACC_FINAL;
4889+
zend_ffi_parser_exception_ce = register_class_FFI_ParserException(zend_ffi_exception_ce);
48954890

4896-
INIT_CLASS_ENTRY(ce, "FFI", class_FFI_methods);
4897-
zend_ffi_ce = zend_register_internal_class(&ce);
4898-
zend_ffi_ce->ce_flags |= ZEND_ACC_FINAL;
4891+
zend_ffi_ce = register_class_FFI();
48994892
zend_ffi_ce->create_object = zend_ffi_new;
49004893
zend_ffi_ce->serialize = zend_class_serialize_deny;
49014894
zend_ffi_ce->unserialize = zend_class_unserialize_deny;
@@ -4930,9 +4923,7 @@ ZEND_MINIT_FUNCTION(ffi)
49304923

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

4933-
INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", NULL);
4934-
zend_ffi_cdata_ce = zend_register_internal_class(&ce);
4935-
zend_ffi_cdata_ce->ce_flags |= ZEND_ACC_FINAL;
4926+
zend_ffi_cdata_ce = register_class_FFI_CData();
49364927
zend_ffi_cdata_ce->create_object = zend_ffi_cdata_new;
49374928
zend_ffi_cdata_ce->get_iterator = zend_ffi_cdata_get_iterator;
49384929
zend_ffi_cdata_ce->serialize = zend_class_serialize_deny;
@@ -5008,9 +4999,7 @@ ZEND_MINIT_FUNCTION(ffi)
50084999
zend_ffi_cdata_free_handlers.get_properties = zend_fake_get_properties;
50095000
zend_ffi_cdata_free_handlers.get_gc = zend_fake_get_gc;
50105001

5011-
INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_FFI_CType_methods);
5012-
zend_ffi_ctype_ce = zend_register_internal_class(&ce);
5013-
zend_ffi_ctype_ce->ce_flags |= ZEND_ACC_FINAL;
5002+
zend_ffi_ctype_ce = register_class_FFI_CType();
50145003
zend_ffi_ctype_ce->create_object = zend_ffi_ctype_new;
50155004
zend_ffi_ctype_ce->serialize = zend_class_serialize_deny;
50165005
zend_ffi_ctype_ce->unserialize = zend_class_unserialize_deny;

ext/ffi/ffi.stub.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/**
4+
* @generate-function-entries
5+
* @generate-class-entries
6+
*/
47

58
namespace {
69

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

6972
namespace FFI {
7073

74+
final class CData {
75+
}
76+
7177
final class CType {
7278
public function getName() : string {}
7379
}
7480

81+
class Exception extends \Error {
82+
}
83+
84+
final class ParserException extends Exception {
85+
}
86+
7587
}

ext/ffi/ffi_arginfo.h

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 5aeec68fea7a94cd643464acfb10bf4cfcc863da */
2+
* Stub hash: f8eb234b7efa2060f54ed300fc6fa697741b0ab6 */
33

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

127127

128+
static const zend_function_entry class_FFI_CData_methods[] = {
129+
ZEND_FE_END
130+
};
131+
132+
128133
static const zend_function_entry class_FFI_CType_methods[] = {
129134
ZEND_ME(FFI_CType, getName, arginfo_class_FFI_CType_getName, ZEND_ACC_PUBLIC)
130135
ZEND_FE_END
131136
};
137+
138+
139+
static const zend_function_entry class_FFI_Exception_methods[] = {
140+
ZEND_FE_END
141+
};
142+
143+
144+
static const zend_function_entry class_FFI_ParserException_methods[] = {
145+
ZEND_FE_END
146+
};
147+
148+
zend_class_entry *register_class_FFI()
149+
{
150+
zend_class_entry ce, *class_entry;
151+
152+
INIT_CLASS_ENTRY(ce, "FFI", class_FFI_methods);
153+
class_entry = zend_register_internal_class_ex(&ce, NULL);
154+
class_entry->ce_flags |= ZEND_ACC_FINAL;
155+
156+
return class_entry;
157+
}
158+
159+
zend_class_entry *register_class_FFI_CData()
160+
{
161+
zend_class_entry ce, *class_entry;
162+
163+
INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", class_FFI_CData_methods);
164+
class_entry = zend_register_internal_class_ex(&ce, NULL);
165+
class_entry->ce_flags |= ZEND_ACC_FINAL;
166+
167+
return class_entry;
168+
}
169+
170+
zend_class_entry *register_class_FFI_CType()
171+
{
172+
zend_class_entry ce, *class_entry;
173+
174+
INIT_NS_CLASS_ENTRY(ce, "FFI", "CType", class_FFI_CType_methods);
175+
class_entry = zend_register_internal_class_ex(&ce, NULL);
176+
class_entry->ce_flags |= ZEND_ACC_FINAL;
177+
178+
return class_entry;
179+
}
180+
181+
zend_class_entry *register_class_FFI_Exception(zend_class_entry *class_entry_Error)
182+
{
183+
zend_class_entry ce, *class_entry;
184+
185+
INIT_NS_CLASS_ENTRY(ce, "FFI", "Exception", class_FFI_Exception_methods);
186+
class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
187+
188+
return class_entry;
189+
}
190+
191+
zend_class_entry *register_class_FFI_ParserException(zend_class_entry *class_entry_FFI_Exception)
192+
{
193+
zend_class_entry ce, *class_entry;
194+
195+
INIT_NS_CLASS_ENTRY(ce, "FFI", "ParserException", class_FFI_ParserException_methods);
196+
class_entry = zend_register_internal_class_ex(&ce, class_entry_FFI_Exception);
197+
class_entry->ce_flags |= ZEND_ACC_FINAL;
198+
199+
return class_entry;
200+
}
201+

ext/fileinfo/fileinfo.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
107107
/* {{{ PHP_MINIT_FUNCTION */
108108
PHP_MINIT_FUNCTION(finfo)
109109
{
110-
zend_class_entry _finfo_class_entry;
111-
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", class_finfo_methods);
112-
finfo_class_entry = zend_register_internal_class(&_finfo_class_entry);
110+
finfo_class_entry = register_class_finfo();
113111
finfo_class_entry->create_object = finfo_objects_new;
114112
finfo_class_entry->serialize = zend_class_serialize_deny;
115113
finfo_class_entry->unserialize = zend_class_unserialize_deny;

ext/fileinfo/fileinfo.stub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/**
4+
* @generate-function-entries
5+
* @generate-class-entries
6+
*/
47

58
class finfo
69
{

ext/fileinfo/fileinfo_arginfo.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 1282a20b1d007bbcc9c0d4efe400db43a5450307 */
2+
* Stub hash: ae5759febdd7ad434c8bf2e23e9da334ff9054dd */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_finfo_open, 0, 0, finfo, MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
@@ -81,3 +81,14 @@ static const zend_function_entry class_finfo_methods[] = {
8181
ZEND_ME_MAPPING(set_flags, finfo_set_flags, arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
8282
ZEND_FE_END
8383
};
84+
85+
zend_class_entry *register_class_finfo()
86+
{
87+
zend_class_entry ce, *class_entry;
88+
89+
INIT_CLASS_ENTRY(ce, "finfo", class_finfo_methods);
90+
class_entry = zend_register_internal_class_ex(&ce, NULL);
91+
92+
return class_entry;
93+
}
94+

ext/filter/filter.stub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/**
4+
* @generate-function-entries
5+
* @generate-class-entries
6+
*/
47

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

ext/filter/filter_arginfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: b5f2e4a79eb6f30fe143b3086845435d0a0a6ef0 */
2+
* Stub hash: dc73178b6c82437ae4eec49984613563018d3bde */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, input_type, IS_LONG, 0)
@@ -58,3 +58,4 @@ static const zend_function_entry ext_functions[] = {
5858
ZEND_FE(filter_id, arginfo_filter_id)
5959
ZEND_FE_END
6060
};
61+

ext/ftp/ftp.stub.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/**
4+
* @generate-function-entries
5+
* @generate-class-entries
6+
*/
7+
8+
/** @strict-properties */
9+
final class FTPConnection
10+
{
11+
}
412

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

ext/ftp/ftp_arginfo.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 151310a13eeeb2bbf4df1ab38a3a29506b26a570 */
2+
* Stub hash: d72294d567338c30f627b8247a8cc27148237e41 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_connect, 0, 1, FTPConnection, MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
@@ -274,3 +274,20 @@ static const zend_function_entry ext_functions[] = {
274274
ZEND_FE(ftp_get_option, arginfo_ftp_get_option)
275275
ZEND_FE_END
276276
};
277+
278+
279+
static const zend_function_entry class_FTPConnection_methods[] = {
280+
ZEND_FE_END
281+
};
282+
283+
zend_class_entry *register_class_FTPConnection()
284+
{
285+
zend_class_entry ce, *class_entry;
286+
287+
INIT_CLASS_ENTRY(ce, "FTPConnection", class_FTPConnection_methods);
288+
class_entry = zend_register_internal_class_ex(&ce, NULL);
289+
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
290+
291+
return class_entry;
292+
}
293+

ext/ftp/php_ftp.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ static void ftp_object_destroy(zend_object *zobj) {
9797

9898
PHP_MINIT_FUNCTION(ftp)
9999
{
100-
zend_class_entry ce;
101-
102100
#ifdef HAVE_FTP_SSL
103101
#if OPENSSL_VERSION_NUMBER < 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
104102
SSL_library_init();
@@ -110,9 +108,7 @@ PHP_MINIT_FUNCTION(ftp)
110108
#endif
111109
#endif
112110

113-
INIT_CLASS_ENTRY(ce, "FTPConnection", NULL);
114-
php_ftp_ce = zend_register_internal_class(&ce);
115-
php_ftp_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
111+
php_ftp_ce = register_class_FTPConnection();
116112
php_ftp_ce->create_object = ftp_object_create;
117113
php_ftp_ce->serialize = zend_class_serialize_deny;
118114
php_ftp_ce->unserialize = zend_class_unserialize_deny;

0 commit comments

Comments
 (0)