Skip to content

Commit c672372

Browse files
committed
Generate ext/intl class entries from stubs
Closes GH-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

Lines changed: 1 addition & 7 deletions
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

Lines changed: 33 additions & 10 deletions
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

Lines changed: 6 additions & 16 deletions
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

Lines changed: 2 additions & 6 deletions
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,
Lines changed: 9 additions & 0 deletions
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+
}
Lines changed: 25 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 22 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: 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

Lines changed: 3 additions & 8 deletions
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

Lines changed: 1 addition & 1 deletion
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
{

0 commit comments

Comments
 (0)