Skip to content

Commit c672372

Browse files
committed
Generate ext/intl class entries from stubs
Closes phpGH-6670
1 parent 99b08ac commit c672372

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+276
-157
lines changed

ext/intl/breakiterator/breakiterator.stub.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class IntlBreakIterator implements IteratorAggregate
66
{
@@ -86,12 +86,6 @@ public function getRuleStatus() {}
8686
public function getRuleStatusVec() {}
8787
}
8888

89-
class IntlPartsIterator extends IntlIterator
90-
{
91-
/** @return IntlBreakIterator */
92-
public function getBreakIterator() {}
93-
}
94-
9589
class IntlCodePointBreakIterator extends IntlBreakIterator
9690
{
9791
/** @return int */

ext/intl/breakiterator/breakiterator_arginfo.h

+33-10
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: 6a121ed9817667820f05677a772781d6b788796b */
2+
* Stub hash: 9e9dc1cd1302038f351f6075393494d1a58f0d74 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlBreakIterator_createCharacterInstance, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null")
@@ -72,8 +72,6 @@ ZEND_END_ARG_INFO()
7272

7373
#define arginfo_class_IntlRuleBasedBreakIterator_getRuleStatusVec arginfo_class_IntlBreakIterator_createCodePointInstance
7474

75-
#define arginfo_class_IntlPartsIterator_getBreakIterator arginfo_class_IntlBreakIterator_createCodePointInstance
76-
7775
#define arginfo_class_IntlCodePointBreakIterator_getLastCodePoint arginfo_class_IntlBreakIterator_createCodePointInstance
7876

7977

@@ -104,7 +102,6 @@ ZEND_METHOD(IntlRuleBasedBreakIterator, getBinaryRules);
104102
ZEND_METHOD(IntlRuleBasedBreakIterator, getRules);
105103
ZEND_METHOD(IntlRuleBasedBreakIterator, getRuleStatus);
106104
ZEND_METHOD(IntlRuleBasedBreakIterator, getRuleStatusVec);
107-
ZEND_METHOD(IntlPartsIterator, getBreakIterator);
108105
ZEND_METHOD(IntlCodePointBreakIterator, getLastCodePoint);
109106

110107

@@ -145,13 +142,39 @@ static const zend_function_entry class_IntlRuleBasedBreakIterator_methods[] = {
145142
};
146143

147144

148-
static const zend_function_entry class_IntlPartsIterator_methods[] = {
149-
ZEND_ME(IntlPartsIterator, getBreakIterator, arginfo_class_IntlPartsIterator_getBreakIterator, ZEND_ACC_PUBLIC)
150-
ZEND_FE_END
151-
};
152-
153-
154145
static const zend_function_entry class_IntlCodePointBreakIterator_methods[] = {
155146
ZEND_ME(IntlCodePointBreakIterator, getLastCodePoint, arginfo_class_IntlCodePointBreakIterator_getLastCodePoint, ZEND_ACC_PUBLIC)
156147
ZEND_FE_END
157148
};
149+
150+
zend_class_entry *register_class_IntlBreakIterator(zend_class_entry *class_entry_IteratorAggregate)
151+
{
152+
zend_class_entry ce, *class_entry;
153+
154+
INIT_CLASS_ENTRY(ce, "IntlBreakIterator", class_IntlBreakIterator_methods);
155+
class_entry = zend_register_internal_class_ex(&ce, NULL);
156+
zend_class_implements(class_entry, 1, class_entry_IteratorAggregate);
157+
158+
return class_entry;
159+
}
160+
161+
zend_class_entry *register_class_IntlRuleBasedBreakIterator(zend_class_entry *class_entry_IntlBreakIterator)
162+
{
163+
zend_class_entry ce, *class_entry;
164+
165+
INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator", class_IntlRuleBasedBreakIterator_methods);
166+
class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlBreakIterator);
167+
168+
return class_entry;
169+
}
170+
171+
zend_class_entry *register_class_IntlCodePointBreakIterator(zend_class_entry *class_entry_IntlBreakIterator)
172+
{
173+
zend_class_entry ce, *class_entry;
174+
175+
INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator", class_IntlCodePointBreakIterator_methods);
176+
class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlBreakIterator);
177+
178+
return class_entry;
179+
}
180+

ext/intl/breakiterator/breakiterator_class.cpp

+6-16
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,11 @@ static zend_object *BreakIterator_object_create(zend_class_entry *ce)
220220
*/
221221
U_CFUNC void breakiterator_register_BreakIterator_class(void)
222222
{
223-
zend_class_entry ce;
224-
225223
/* Create and register 'BreakIterator' class. */
226-
INIT_CLASS_ENTRY(ce, "IntlBreakIterator", class_IntlBreakIterator_methods);
227-
ce.create_object = BreakIterator_object_create;
228-
ce.get_iterator = _breakiterator_get_iterator;
229-
BreakIterator_ce_ptr = zend_register_internal_class(&ce);
224+
225+
BreakIterator_ce_ptr = register_class_IntlBreakIterator(zend_ce_aggregate);
226+
BreakIterator_ce_ptr->create_object = BreakIterator_object_create;
227+
BreakIterator_ce_ptr->get_iterator = _breakiterator_get_iterator;
230228

231229
memcpy(&BreakIterator_handlers, &std_object_handlers,
232230
sizeof BreakIterator_handlers);
@@ -236,8 +234,6 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void)
236234
BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info;
237235
BreakIterator_handlers.free_obj = BreakIterator_objects_free;
238236

239-
zend_class_implements(BreakIterator_ce_ptr, 1, zend_ce_aggregate);
240-
241237
zend_declare_class_constant_long(BreakIterator_ce_ptr,
242238
"DONE", sizeof("DONE") - 1, BreakIterator::DONE );
243239

@@ -271,15 +267,9 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void)
271267

272268

273269
/* Create and register 'RuleBasedBreakIterator' class. */
274-
INIT_CLASS_ENTRY(ce, "IntlRuleBasedBreakIterator",
275-
class_IntlRuleBasedBreakIterator_methods);
276-
RuleBasedBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce,
277-
BreakIterator_ce_ptr);
270+
RuleBasedBreakIterator_ce_ptr = register_class_IntlRuleBasedBreakIterator(BreakIterator_ce_ptr);
278271

279272
/* Create and register 'CodePointBreakIterator' class. */
280-
INIT_CLASS_ENTRY(ce, "IntlCodePointBreakIterator",
281-
class_IntlCodePointBreakIterator_methods);
282-
CodePointBreakIterator_ce_ptr = zend_register_internal_class_ex(&ce,
283-
BreakIterator_ce_ptr);
273+
CodePointBreakIterator_ce_ptr = register_class_IntlCodePointBreakIterator(BreakIterator_ce_ptr);
284274
}
285275
/* }}} */

ext/intl/breakiterator/breakiterator_iterators.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extern "C" {
2525
#define USE_BREAKITERATOR_POINTER
2626
#include "breakiterator_class.h"
27-
#include "breakiterator_arginfo.h"
27+
#include "breakiterator_iterators_arginfo.h"
2828
#include "../intl_convert.h"
2929
#include "../locale/locale.h"
3030
#include <zend_exceptions.h>
@@ -287,12 +287,8 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
287287

288288
U_CFUNC void breakiterator_register_IntlPartsIterator_class(void)
289289
{
290-
zend_class_entry ce;
291-
292290
/* Create and register 'BreakIterator' class. */
293-
INIT_CLASS_ENTRY(ce, "IntlPartsIterator", class_IntlPartsIterator_methods);
294-
IntlPartsIterator_ce_ptr = zend_register_internal_class_ex(&ce,
295-
IntlIterator_ce_ptr);
291+
IntlPartsIterator_ce_ptr = register_class_IntlPartsIterator(IntlIterator_ce_ptr);
296292
IntlPartsIterator_ce_ptr->create_object = IntlPartsIterator_object_create;
297293

298294
memcpy(&IntlPartsIterator_handlers, &IntlIterator_handlers,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
/** @generate-class-entries */
4+
5+
class IntlPartsIterator extends IntlIterator
6+
{
7+
/** @return IntlBreakIterator */
8+
public function getBreakIterator() {}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: 5e165fe25d6d13824da9d7c5f0a089ee11626689 */
3+
4+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlPartsIterator_getBreakIterator, 0, 0, 0)
5+
ZEND_END_ARG_INFO()
6+
7+
8+
ZEND_METHOD(IntlPartsIterator, getBreakIterator);
9+
10+
11+
static const zend_function_entry class_IntlPartsIterator_methods[] = {
12+
ZEND_ME(IntlPartsIterator, getBreakIterator, arginfo_class_IntlPartsIterator_getBreakIterator, ZEND_ACC_PUBLIC)
13+
ZEND_FE_END
14+
};
15+
16+
zend_class_entry *register_class_IntlPartsIterator(zend_class_entry *class_entry_IntlIterator)
17+
{
18+
zend_class_entry ce, *class_entry;
19+
20+
INIT_CLASS_ENTRY(ce, "IntlPartsIterator", class_IntlPartsIterator_methods);
21+
class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlIterator);
22+
23+
return class_entry;
24+
}
25+

ext/intl/calendar/calendar.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class IntlCalendar
66
{

ext/intl/calendar/calendar_arginfo.h

+22-1
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: 18a92d3af801f11e5c3b90e5d272fd98b3515c40 */
2+
* Stub hash: a0800bd27fe214cce7420e689e9d7b519a7b6835 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -270,3 +270,24 @@ static const zend_function_entry class_IntlGregorianCalendar_methods[] = {
270270
ZEND_ME_MAPPING(isLeapYear, intlgregcal_is_leap_year, arginfo_class_IntlGregorianCalendar_isLeapYear, ZEND_ACC_PUBLIC)
271271
ZEND_FE_END
272272
};
273+
274+
zend_class_entry *register_class_IntlCalendar()
275+
{
276+
zend_class_entry ce, *class_entry;
277+
278+
INIT_CLASS_ENTRY(ce, "IntlCalendar", class_IntlCalendar_methods);
279+
class_entry = zend_register_internal_class_ex(&ce, NULL);
280+
281+
return class_entry;
282+
}
283+
284+
zend_class_entry *register_class_IntlGregorianCalendar(zend_class_entry *class_entry_IntlCalendar)
285+
{
286+
zend_class_entry ce, *class_entry;
287+
288+
INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", class_IntlGregorianCalendar_methods);
289+
class_entry = zend_register_internal_class_ex(&ce, class_entry_IntlCalendar);
290+
291+
return class_entry;
292+
}
293+

ext/intl/calendar/calendar_class.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,9 @@ static zend_object *Calendar_object_create(zend_class_entry *ce)
268268
*/
269269
void calendar_register_IntlCalendar_class(void)
270270
{
271-
zend_class_entry ce;
272-
273271
/* Create and register 'IntlCalendar' class. */
274-
INIT_CLASS_ENTRY(ce, "IntlCalendar", class_IntlCalendar_methods);
275-
ce.create_object = Calendar_object_create;
276-
Calendar_ce_ptr = zend_register_internal_class(&ce);
272+
Calendar_ce_ptr = register_class_IntlCalendar();
273+
Calendar_ce_ptr->create_object = Calendar_object_create;
277274

278275
memcpy( &Calendar_handlers, &std_object_handlers,
279276
sizeof Calendar_handlers);
@@ -331,8 +328,6 @@ void calendar_register_IntlCalendar_class(void)
331328
CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID);
332329

333330
/* Create and register 'IntlGregorianCalendar' class. */
334-
INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", class_IntlGregorianCalendar_methods);
335-
GregorianCalendar_ce_ptr = zend_register_internal_class_ex(&ce,
336-
Calendar_ce_ptr);
331+
GregorianCalendar_ce_ptr = register_class_IntlGregorianCalendar(Calendar_ce_ptr);
337332
}
338333
/* }}} */

ext/intl/collator/collator.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class Collator
66
{

ext/intl/collator/collator_arginfo.h

+12-1
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: 869c6e60a8f2b153ef79f28a08e165ff3ec2bc14 */
2+
* Stub hash: 9907156bf1d28af7bf6a1858dffc58994c12756f */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
@@ -85,3 +85,14 @@ static const zend_function_entry class_Collator_methods[] = {
8585
ZEND_ME_MAPPING(getSortKey, collator_get_sort_key, arginfo_class_Collator_getSortKey, ZEND_ACC_PUBLIC)
8686
ZEND_FE_END
8787
};
88+
89+
zend_class_entry *register_class_Collator()
90+
{
91+
zend_class_entry ce, *class_entry;
92+
93+
INIT_CLASS_ENTRY(ce, "Collator", class_Collator_methods);
94+
class_entry = zend_register_internal_class_ex(&ce, NULL);
95+
96+
return class_entry;
97+
}
98+

ext/intl/collator/collator_class.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ zend_object *Collator_object_create(zend_class_entry *ce )
6363
*/
6464
void collator_register_Collator_class( void )
6565
{
66-
zend_class_entry ce;
67-
6866
/* Create and register 'Collator' class. */
69-
INIT_CLASS_ENTRY( ce, "Collator", class_Collator_methods );
70-
ce.create_object = Collator_object_create;
71-
Collator_ce_ptr = zend_register_internal_class( &ce );
67+
Collator_ce_ptr = register_class_Collator();
68+
Collator_ce_ptr->create_object = Collator_object_create;
7269

7370
memcpy(&Collator_handlers, &std_object_handlers,
7471
sizeof Collator_handlers);

ext/intl/converter/converter.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -966,10 +966,7 @@ static zend_object *php_converter_clone_object(zend_object *object) {
966966

967967
/* {{{ php_converter_minit */
968968
int php_converter_minit(INIT_FUNC_ARGS) {
969-
zend_class_entry ce;
970-
971-
INIT_CLASS_ENTRY(ce, "UConverter", class_UConverter_methods);
972-
php_converter_ce = zend_register_internal_class(&ce);
969+
php_converter_ce = register_class_UConverter();
973970
php_converter_ce->create_object = php_converter_create_object;
974971
memcpy(&php_converter_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
975972
php_converter_object_handlers.offset = XtOffsetOf(php_converter_object, obj);

ext/intl/converter/converter.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class UConverter
66
{

ext/intl/converter/converter_arginfo.h

+12-1
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: e33e2614c969c59b79c6062f7a347a8e8e486d85 */
2+
* Stub hash: c01b6c9d6a6754a2fffde1279bec3a984e6a2f34 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null")
@@ -113,3 +113,14 @@ static const zend_function_entry class_UConverter_methods[] = {
113113
ZEND_ME(UConverter, transcode, arginfo_class_UConverter_transcode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
114114
ZEND_FE_END
115115
};
116+
117+
zend_class_entry *register_class_UConverter()
118+
{
119+
zend_class_entry ce, *class_entry;
120+
121+
INIT_CLASS_ENTRY(ce, "UConverter", class_UConverter_methods);
122+
class_entry = zend_register_internal_class_ex(&ce, NULL);
123+
124+
return class_entry;
125+
}
126+

ext/intl/dateformat/dateformat.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class IntlDateFormatter
66
{

ext/intl/dateformat/dateformat_arginfo.h

+12-1
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: 62742b5f463272f43970e98900a89d513c4fb839 */
2+
* Stub hash: 4f93c3fca18c225b26dec1e970b783baa4622425 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3)
55
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
@@ -125,3 +125,14 @@ static const zend_function_entry class_IntlDateFormatter_methods[] = {
125125
ZEND_ME_MAPPING(getErrorMessage, datefmt_get_error_message, arginfo_class_IntlDateFormatter_getErrorMessage, ZEND_ACC_PUBLIC)
126126
ZEND_FE_END
127127
};
128+
129+
zend_class_entry *register_class_IntlDateFormatter()
130+
{
131+
zend_class_entry ce, *class_entry;
132+
133+
INIT_CLASS_ENTRY(ce, "IntlDateFormatter", class_IntlDateFormatter_methods);
134+
class_entry = zend_register_internal_class_ex(&ce, NULL);
135+
136+
return class_entry;
137+
}
138+

ext/intl/dateformat/dateformat_class.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,9 @@ zend_object *IntlDateFormatter_object_clone(zend_object *object)
107107
*/
108108
void dateformat_register_IntlDateFormatter_class( void )
109109
{
110-
zend_class_entry ce;
111-
112110
/* Create and register 'IntlDateFormatter' class. */
113-
INIT_CLASS_ENTRY( ce, "IntlDateFormatter", class_IntlDateFormatter_methods );
114-
ce.create_object = IntlDateFormatter_object_create;
115-
IntlDateFormatter_ce_ptr = zend_register_internal_class( &ce );
111+
IntlDateFormatter_ce_ptr = register_class_IntlDateFormatter();
112+
IntlDateFormatter_ce_ptr->create_object = IntlDateFormatter_object_create;
116113

117114
memcpy(&IntlDateFormatter_handlers, &std_object_handlers,
118115
sizeof IntlDateFormatter_handlers);

ext/intl/formatter/formatter.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/** @generate-function-entries */
3+
/** @generate-class-entries */
44

55
class NumberFormatter
66
{

0 commit comments

Comments
 (0)