Skip to content

Commit b1eb8b9

Browse files
committed
Generate method entries from stubs for a couple of extensions
1 parent ca006e5 commit b1eb8b9

22 files changed

+155
-131
lines changed

Zend/zend_API.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,20 @@ typedef struct _zend_fcall_info_cache {
7373
#define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags) { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
7474

7575
/* Same as ZEND_NAMED_FE */
76-
#define ZEND_RAW_NAMED_FE(zend_name, name, arg_info) ZEND_RAW_FENTRY(#zend_name, name, arg_info, 0)
77-
78-
#define ZEND_NAMED_FE(zend_name, name, arg_info) ZEND_RAW_FENTRY(#zend_name, name, arg_info, 0)
79-
#define ZEND_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, 0)
80-
#define ZEND_DEP_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, ZEND_ACC_DEPRECATED)
81-
#define ZEND_FALIAS(name, alias, arg_info) ZEND_RAW_FENTRY(#name, zif_##alias, arg_info, 0)
82-
#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_RAW_FENTRY(#name, zif_##alias, arg_info, ZEND_ACC_DEPRECATED)
83-
#define ZEND_NAMED_ME(zend_name, name, arg_info, flags) ZEND_FENTRY(zend_name, name, arg_info, flags)
84-
#define ZEND_ME(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, zim_##classname##_##name, arg_info, flags)
85-
#define ZEND_DEP_ME(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, zim_##classname##_##name, arg_info, flags | ZEND_ACC_DEPRECATED)
86-
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_RAW_FENTRY(#name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
87-
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) ZEND_RAW_FENTRY(#name, zim_##classname##_##alias, arg_info, flags)
88-
#define ZEND_ME_MAPPING(name, func_name, arg_info, flags) ZEND_RAW_FENTRY(#name, zif_##func_name, arg_info, flags)
76+
#define ZEND_RAW_NAMED_FE(zend_name, name, arg_info) ZEND_RAW_FENTRY(#zend_name, name, arg_info, 0)
77+
78+
#define ZEND_NAMED_FE(zend_name, name, arg_info) ZEND_RAW_FENTRY(#zend_name, name, arg_info, 0)
79+
#define ZEND_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, 0)
80+
#define ZEND_DEP_FE(name, arg_info) ZEND_RAW_FENTRY(#name, zif_##name, arg_info, ZEND_ACC_DEPRECATED)
81+
#define ZEND_FALIAS(name, alias, arg_info) ZEND_RAW_FENTRY(#name, zif_##alias, arg_info, 0)
82+
#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_RAW_FENTRY(#name, zif_##alias, arg_info, ZEND_ACC_DEPRECATED)
83+
#define ZEND_NAMED_ME(zend_name, name, arg_info, flags) ZEND_FENTRY(zend_name, name, arg_info, flags)
84+
#define ZEND_ME(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, zim_##classname##_##name, arg_info, flags)
85+
#define ZEND_DEP_ME(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, zim_##classname##_##name, arg_info, flags | ZEND_ACC_DEPRECATED)
86+
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_RAW_FENTRY(#name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
87+
#define ZEND_ABSTRACT_ME_WITH_FLAGS(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, NULL, arg_info, flags)
88+
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) ZEND_RAW_FENTRY(#name, zim_##classname##_##alias, arg_info, flags)
89+
#define ZEND_ME_MAPPING(name, func_name, arg_info, flags) ZEND_RAW_FENTRY(#name, zif_##func_name, arg_info, flags)
8990

9091
#define ZEND_NS_FENTRY(ns, zend_name, name, arg_info, flags) ZEND_RAW_FENTRY(ZEND_NS_NAME(ns, #zend_name), name, arg_info, flags)
9192

build/gen_stub.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ public function getFunctionEntry(): string {
447447
} else {
448448
if ($this->flags & Class_::MODIFIER_ABSTRACT) {
449449
return sprintf(
450-
"\tZEND_ABSTRACT_ME(%s, %s, %s)\n",
451-
$this->name->className, $this->name->name, $this->getArgInfoName()
450+
"\tZEND_ABSTRACT_ME_WITH_FLAGS(%s, %s, %s, %s)\n",
451+
$this->name->className, $this->name->name, $this->getArgInfoName(), $this->getFlagsAsString()
452452
);
453453
}
454454

@@ -797,8 +797,8 @@ function parseStubFile(string $fileName): FileInfo {
797797
$flags |= Class_::MODIFIER_ABSTRACT;
798798
}
799799

800-
if ($flags & Class_::MODIFIER_ABSTRACT && !($flags & Class_::MODIFIER_PUBLIC)) {
801-
throw new Exception("Abstract non-public methods are not supported");
800+
if (!($flags & Class_::VISIBILITY_MODIFIER_MASK)) {
801+
throw new Exception("Method visibility modifier is required");
802802
}
803803

804804
$methodInfos[] = parseFunctionLike(
@@ -984,9 +984,9 @@ function (FuncInfo $funcInfo) use(&$generatedFunctionDeclarations) {
984984
}
985985
);
986986

987-
$code .= "\n\n";
988-
989-
$code .= generateFunctionEntries(null, $fileInfo->funcInfos);
987+
if (empty($fileInfo->funcInfos) === false) {
988+
$code .= generateFunctionEntries(null, $fileInfo->funcInfos);
989+
}
990990

991991
foreach ($fileInfo->classInfos as $classInfo) {
992992
$code .= generateFunctionEntries($classInfo->name, $classInfo->funcInfos);

ext/com_dotnet/com_extension.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ zend_class_entry
3737
*php_com_exception_class_entry,
3838
*php_com_saproxy_class_entry;
3939

40-
static const zend_function_entry com_variant_funcs[] = {
41-
PHP_ME(variant, __construct, arginfo_class_variant___construct, ZEND_ACC_PUBLIC)
42-
PHP_FE_END
43-
};
44-
45-
static const zend_function_entry com_com_funcs[] = {
46-
PHP_ME(com, __construct, arginfo_class_com___construct, ZEND_ACC_PUBLIC)
47-
PHP_FE_END
48-
};
49-
50-
static const zend_function_entry com_dotnet_funcs[] = {
51-
PHP_ME(dotnet, __construct, arginfo_class_dotnet___construct, ZEND_ACC_PUBLIC)
52-
PHP_FE_END
53-
};
54-
5540
/* {{{ com_dotnet_module_entry
5641
*/
5742
zend_module_entry com_dotnet_module_entry = {
@@ -196,22 +181,22 @@ PHP_MINIT_FUNCTION(com_dotnet)
196181
/* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
197182
php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;
198183

199-
INIT_CLASS_ENTRY(ce, "variant", com_variant_funcs);
184+
INIT_CLASS_ENTRY(ce, "variant", class_variant_methods);
200185
ce.create_object = php_com_object_new;
201186
php_com_variant_class_entry = zend_register_internal_class(&ce);
202187
php_com_variant_class_entry->get_iterator = php_com_iter_get;
203188
php_com_variant_class_entry->serialize = zend_class_serialize_deny;
204189
php_com_variant_class_entry->unserialize = zend_class_unserialize_deny;
205190

206-
INIT_CLASS_ENTRY(ce, "com", com_com_funcs);
191+
INIT_CLASS_ENTRY(ce, "com", class_com_methods);
207192
ce.create_object = php_com_object_new;
208193
tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
209194
tmp->get_iterator = php_com_iter_get;
210195
tmp->serialize = zend_class_serialize_deny;
211196
tmp->unserialize = zend_class_unserialize_deny;
212197

213198
#if HAVE_MSCOREE_H
214-
INIT_CLASS_ENTRY(ce, "dotnet", com_dotnet_funcs);
199+
INIT_CLASS_ENTRY(ce, "dotnet", class_dotnet_methods);
215200
ce.create_object = php_com_object_new;
216201
tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry);
217202
tmp->get_iterator = php_com_iter_get;

ext/com_dotnet/com_extension_arginfo.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ ZEND_FUNCTION(com_event_sink);
163163
ZEND_FUNCTION(com_print_typeinfo);
164164
ZEND_FUNCTION(com_message_pump);
165165
ZEND_FUNCTION(com_load_typelib);
166+
ZEND_METHOD(variant, __construct);
167+
ZEND_METHOD(com, __construct);
168+
#if HAVE_MSCOREE_H
169+
ZEND_METHOD(dotnet, __construct);
170+
#endif
166171

167172

168173
static const zend_function_entry ext_functions[] = {
@@ -200,3 +205,23 @@ static const zend_function_entry ext_functions[] = {
200205
ZEND_FE(com_load_typelib, arginfo_com_load_typelib)
201206
ZEND_FE_END
202207
};
208+
209+
210+
static const zend_function_entry class_variant_methods[] = {
211+
ZEND_ME(variant, __construct, arginfo_class_variant___construct, ZEND_ACC_PUBLIC)
212+
ZEND_FE_END
213+
};
214+
215+
216+
static const zend_function_entry class_com_methods[] = {
217+
ZEND_ME(com, __construct, arginfo_class_com___construct, ZEND_ACC_PUBLIC)
218+
ZEND_FE_END
219+
};
220+
221+
222+
static const zend_function_entry class_dotnet_methods[] = {
223+
#if HAVE_MSCOREE_H
224+
ZEND_ME(dotnet, __construct, arginfo_class_dotnet___construct, ZEND_ACC_PUBLIC)
225+
#endif
226+
ZEND_FE_END
227+
};

ext/com_dotnet/com_persist.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -670,21 +670,6 @@ CPH_METHOD(__construct)
670670
}
671671
/* }}} */
672672

673-
674-
675-
676-
static const zend_function_entry com_persist_helper_methods[] = {
677-
CPH_ME(__construct, arginfo_class_COMPersistHelper___construct)
678-
CPH_ME(GetCurFileName, arginfo_class_COMPersistHelper_GetCurFileName)
679-
CPH_ME(SaveToFile, arginfo_class_COMPersistHelper_SaveToFile)
680-
CPH_ME(LoadFromFile, arginfo_class_COMPersistHelper_LoadFromFile)
681-
CPH_ME(GetMaxStreamSize, arginfo_class_COMPersistHelper_GetMaxStreamSize)
682-
CPH_ME(InitNew, arginfo_class_COMPersistHelper_InitNew)
683-
CPH_ME(LoadFromStream, arginfo_class_COMPersistHelper_LoadFromStream)
684-
CPH_ME(SaveToStream, arginfo_class_COMPersistHelper_SaveToStream)
685-
PHP_FE_END
686-
};
687-
688673
static void helper_free_storage(zend_object *obj)
689674
{
690675
php_com_persist_helper *object = (php_com_persist_helper*)obj;
@@ -750,7 +735,7 @@ int php_com_persist_minit(INIT_FUNC_ARGS)
750735
helper_handlers.free_obj = helper_free_storage;
751736
helper_handlers.clone_obj = helper_clone;
752737

753-
INIT_CLASS_ENTRY(ce, "COMPersistHelper", com_persist_helper_methods);
738+
INIT_CLASS_ENTRY(ce, "COMPersistHelper", class_COMPersistHelper_methods);
754739
ce.create_object = helper_new;
755740
helper_ce = zend_register_internal_class(&ce);
756741
helper_ce->ce_flags |= ZEND_ACC_FINAL;

ext/com_dotnet/com_persist.stub.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<?php
22

3-
final class COMPersistHelper {
4-
public function __construct(?VARIANT $com_object);
3+
/** @generate-function-entries */
54

6-
public function GetCurFileName(): string|false;
5+
final class COMPersistHelper
6+
{
7+
public function __construct(?VARIANT $com_object) {}
78

8-
public function SaveToFile(?string $filename, bool $remember = true): bool;
9+
public function GetCurFileName(): string|false {}
910

10-
public function LoadFromFile(string $path, int $flags = 0): bool;
11+
public function SaveToFile(?string $filename, bool $remember = true): bool {}
1112

12-
public function GetMaxStreamSize(): int;
13+
public function LoadFromFile(string $path, int $flags = 0): bool {}
1314

14-
public function InitNew(): bool;
15+
public function GetMaxStreamSize(): int {}
16+
17+
public function InitNew(): bool {}
1518

1619
/** @param resource $stream */
17-
public function LoadFromStream($stream): bool;
20+
public function LoadFromStream($stream): bool {}
1821

1922
/** @param resource $stream */
20-
public function SaveToStream($stream): bool;
23+
public function SaveToStream($stream): bool {}
2124
}

ext/com_dotnet/com_persist_arginfo.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,26 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_COMPersistHelper_LoadFromS
2828
ZEND_END_ARG_INFO()
2929

3030
#define arginfo_class_COMPersistHelper_SaveToStream arginfo_class_COMPersistHelper_LoadFromStream
31+
32+
33+
ZEND_METHOD(COMPersistHelper, __construct);
34+
ZEND_METHOD(COMPersistHelper, GetCurFileName);
35+
ZEND_METHOD(COMPersistHelper, SaveToFile);
36+
ZEND_METHOD(COMPersistHelper, LoadFromFile);
37+
ZEND_METHOD(COMPersistHelper, GetMaxStreamSize);
38+
ZEND_METHOD(COMPersistHelper, InitNew);
39+
ZEND_METHOD(COMPersistHelper, LoadFromStream);
40+
ZEND_METHOD(COMPersistHelper, SaveToStream);
41+
42+
43+
static const zend_function_entry class_COMPersistHelper_methods[] = {
44+
ZEND_ME(COMPersistHelper, __construct, arginfo_class_COMPersistHelper___construct, ZEND_ACC_PUBLIC)
45+
ZEND_ME(COMPersistHelper, GetCurFileName, arginfo_class_COMPersistHelper_GetCurFileName, ZEND_ACC_PUBLIC)
46+
ZEND_ME(COMPersistHelper, SaveToFile, arginfo_class_COMPersistHelper_SaveToFile, ZEND_ACC_PUBLIC)
47+
ZEND_ME(COMPersistHelper, LoadFromFile, arginfo_class_COMPersistHelper_LoadFromFile, ZEND_ACC_PUBLIC)
48+
ZEND_ME(COMPersistHelper, GetMaxStreamSize, arginfo_class_COMPersistHelper_GetMaxStreamSize, ZEND_ACC_PUBLIC)
49+
ZEND_ME(COMPersistHelper, InitNew, arginfo_class_COMPersistHelper_InitNew, ZEND_ACC_PUBLIC)
50+
ZEND_ME(COMPersistHelper, LoadFromStream, arginfo_class_COMPersistHelper_LoadFromStream, ZEND_ACC_PUBLIC)
51+
ZEND_ME(COMPersistHelper, SaveToStream, arginfo_class_COMPersistHelper_SaveToStream, ZEND_ACC_PUBLIC)
52+
ZEND_FE_END
53+
};

ext/date/php_date_arginfo.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,6 @@ ZEND_METHOD(DatePeriod, __wakeup);
504504
ZEND_METHOD(DatePeriod, __set_state);
505505

506506

507-
508-
509507
static const zend_function_entry ext_functions[] = {
510508
ZEND_FE(strtotime, arginfo_strtotime)
511509
ZEND_FE(date, arginfo_date)
@@ -560,12 +558,12 @@ static const zend_function_entry ext_functions[] = {
560558

561559

562560
static const zend_function_entry class_DateTimeInterface_methods[] = {
563-
ZEND_ABSTRACT_ME(DateTimeInterface, format, arginfo_class_DateTimeInterface_format)
564-
ZEND_ABSTRACT_ME(DateTimeInterface, getTimezone, arginfo_class_DateTimeInterface_getTimezone)
565-
ZEND_ABSTRACT_ME(DateTimeInterface, getOffset, arginfo_class_DateTimeInterface_getOffset)
566-
ZEND_ABSTRACT_ME(DateTimeInterface, getTimestamp, arginfo_class_DateTimeInterface_getTimestamp)
567-
ZEND_ABSTRACT_ME(DateTimeInterface, diff, arginfo_class_DateTimeInterface_diff)
568-
ZEND_ABSTRACT_ME(DateTimeInterface, __wakeup, arginfo_class_DateTimeInterface___wakeup)
561+
ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, format, arginfo_class_DateTimeInterface_format, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
562+
ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, getTimezone, arginfo_class_DateTimeInterface_getTimezone, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
563+
ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, getOffset, arginfo_class_DateTimeInterface_getOffset, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
564+
ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, getTimestamp, arginfo_class_DateTimeInterface_getTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
565+
ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, diff, arginfo_class_DateTimeInterface_diff, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
566+
ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, __wakeup, arginfo_class_DateTimeInterface___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
569567
ZEND_FE_END
570568
};
571569

ext/dom/documenttype.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@
2323
#if HAVE_LIBXML && HAVE_DOM
2424
#include "php_dom.h"
2525

26-
/*
27-
* class DOMDocumentType extends DOMNode
28-
*
29-
* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-412266927
30-
* Since:
31-
*/
32-
33-
const zend_function_entry php_dom_documenttype_class_functions[] = {
34-
PHP_FE_END
35-
};
36-
3726
/* {{{ name string
3827
readonly=yes
3928
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1844763134

ext/dom/dom_arginfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ static const zend_function_entry ext_functions[] = {
1212
ZEND_FE(dom_import_simplexml, arginfo_dom_import_simplexml)
1313
ZEND_FE_END
1414
};
15+
16+
17+
static const zend_function_entry class_DOMDocumentType_methods[] = {
18+
ZEND_FE_END
19+
};

ext/dom/dom_fe.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ extern const zend_function_entry php_dom_element_class_functions[];
3333
extern const zend_function_entry php_dom_text_class_functions[];
3434
extern const zend_function_entry php_dom_comment_class_functions[];
3535
extern const zend_function_entry php_dom_cdatasection_class_functions[];
36-
extern const zend_function_entry php_dom_documenttype_class_functions[];
3736
extern const zend_function_entry php_dom_notation_class_functions[];
3837
extern const zend_function_entry php_dom_entity_class_functions[];
3938
extern const zend_function_entry php_dom_entityreference_class_functions[];

ext/dom/php_dom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ PHP_MINIT_FUNCTION(dom)
737737
REGISTER_DOM_CLASS(ce, "DOMCdataSection", dom_text_class_entry, php_dom_cdatasection_class_functions, dom_cdatasection_class_entry);
738738
zend_hash_add_ptr(&classes, ce.name, &dom_text_prop_handlers);
739739

740-
REGISTER_DOM_CLASS(ce, "DOMDocumentType", dom_node_class_entry, php_dom_documenttype_class_functions, dom_documenttype_class_entry);
740+
REGISTER_DOM_CLASS(ce, "DOMDocumentType", dom_node_class_entry, class_DOMDocumentType_methods, dom_documenttype_class_entry);
741741

742742
zend_hash_init(&dom_documenttype_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
743743
dom_register_prop_handler(&dom_documenttype_prop_handlers, "name", sizeof("name")-1, dom_documenttype_name_read, NULL);

ext/fileinfo/fileinfo.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,6 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
107107
}
108108
/* }}} */
109109

110-
/* {{{ finfo_class_functions
111-
*/
112-
static const zend_function_entry finfo_class_functions[] = {
113-
ZEND_ME_MAPPING(__construct, finfo_open, arginfo_class_finfo___construct, ZEND_ACC_PUBLIC)
114-
ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
115-
ZEND_ME_MAPPING(file, finfo_file, arginfo_class_finfo_file, ZEND_ACC_PUBLIC)
116-
ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_class_finfo_buffer, ZEND_ACC_PUBLIC)
117-
PHP_FE_END
118-
};
119-
/* }}} */
120-
121110
#define FINFO_SET_OPTION(magic, options) \
122111
if (magic_setflags(magic, options) == -1) { \
123112
php_error_docref(NULL, E_WARNING, "Failed to set option '" ZEND_LONG_FMT "' %d:%s", \
@@ -145,7 +134,7 @@ void finfo_resource_destructor(zend_resource *rsrc) /* {{{ */
145134
PHP_MINIT_FUNCTION(finfo)
146135
{
147136
zend_class_entry _finfo_class_entry;
148-
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", finfo_class_functions);
137+
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", class_finfo_methods);
149138
_finfo_class_entry.create_object = finfo_objects_new;
150139
finfo_class_entry = zend_register_internal_class(&_finfo_class_entry);
151140

ext/fileinfo/fileinfo.stub.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@
44

55
class finfo
66
{
7+
/** @alias finfo_open */
78
public function __construct(int $options = FILEINFO_NONE, string $arg = "") {}
89

910
/**
1011
* @param ?resource $context
1112
* @return string|false
13+
* @alias finfo_file
1214
*/
1315
public function file(string $file_name, int $options = FILEINFO_NONE, $context = null) {}
1416

1517
/**
1618
* @param ?resource $context
1719
* @return string|false
20+
* @alias finfo_buffer
1821
*/
1922
public function buffer(string $string, int $options = FILEINFO_NONE, $context = null) {}
2023

21-
/** @return bool */
24+
/**
25+
* @return bool
26+
* @alias finfo_set_flags
27+
*/
2228
public function set_flags(int $options) {}
2329
}
2430

ext/fileinfo/fileinfo_arginfo.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,12 @@ static const zend_function_entry ext_functions[] = {
6868
ZEND_FE(mime_content_type, arginfo_mime_content_type)
6969
ZEND_FE_END
7070
};
71+
72+
73+
static const zend_function_entry class_finfo_methods[] = {
74+
ZEND_ME_MAPPING(__construct, finfo_open, arginfo_class_finfo___construct, ZEND_ACC_PUBLIC)
75+
ZEND_ME_MAPPING(file, finfo_file, arginfo_class_finfo_file, ZEND_ACC_PUBLIC)
76+
ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_class_finfo_buffer, ZEND_ACC_PUBLIC)
77+
ZEND_ME_MAPPING(set_flags, finfo_set_flags, arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
78+
ZEND_FE_END
79+
};

0 commit comments

Comments
 (0)