diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-01-26 11:50:36 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-01-26 11:50:36 +0100 |
commit | 1954e5975846b3952ce1d2d6506e6d7134c89684 (patch) | |
tree | db386159cd317fce6f5f2d04fefd45b70244368f /Zend | |
parent | 4414fd93d06490e726dc04814ba412822170b712 (diff) | |
download | php-git-1954e5975846b3952ce1d2d6506e6d7134c89684.tar.gz |
Add support for generating class entries from stubs
Closes GH-6289
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_exceptions.c | 86 | ||||
-rw-r--r-- | Zend/zend_exceptions.stub.php | 47 | ||||
-rw-r--r-- | Zend/zend_exceptions_arginfo.h | 217 | ||||
-rw-r--r-- | Zend/zend_generators.c | 11 | ||||
-rw-r--r-- | Zend/zend_generators.stub.php | 10 | ||||
-rw-r--r-- | Zend/zend_generators_arginfo.h | 30 |
6 files changed, 329 insertions, 72 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index e93526689d..0026860ef8 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -53,14 +53,21 @@ static zend_object_handlers default_exception_handlers; /* {{{ zend_implement_throwable */ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type) { - if (instanceof_function(class_type, zend_ce_exception) || instanceof_function(class_type, zend_ce_error)) { + /* zend_ce_exception and zend_ce_error may not be initialized yet when this is caleld (e.g when + * implementing Throwable for Exception itself). Perform a manual inheritance check. */ + zend_class_entry *root = class_type; + while (root->parent) { + root = root->parent; + } + if (zend_string_equals_literal(root->name, "Exception") + || zend_string_equals_literal(root->name, "Error")) { return SUCCESS; } - zend_error_noreturn(E_ERROR, "Class %s cannot implement interface %s, extend %s or %s instead", + + zend_error_noreturn(E_ERROR, + "Class %s cannot implement interface %s, extend Exception or Error instead", ZSTR_VAL(class_type->name), - ZSTR_VAL(interface->name), - ZSTR_VAL(zend_ce_exception->name), - ZSTR_VAL(zend_ce_error->name)); + ZSTR_VAL(interface->name)); return FAILURE; } /* }}} */ @@ -740,87 +747,50 @@ ZEND_METHOD(Exception, __toString) } /* }}} */ -static void declare_exception_properties(zend_class_entry *ce) -{ - zval val; - - zend_declare_property_string(ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED); - zend_declare_property_string(ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE); - zend_declare_property_long(ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED); - zend_declare_property_null(ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED); - zend_declare_property_null(ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED); - - ZVAL_EMPTY_ARRAY(&val); - zend_declare_typed_property( - ce, ZSTR_KNOWN(ZEND_STR_TRACE), &val, ZEND_ACC_PRIVATE, NULL, - (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - - ZVAL_NULL(&val); - zend_declare_typed_property( - ce, ZSTR_KNOWN(ZEND_STR_PREVIOUS), &val, ZEND_ACC_PRIVATE, NULL, - (zend_type) ZEND_TYPE_INIT_CE(zend_ce_throwable, /* allow_null */ 1, 0)); -} - void zend_register_default_exception(void) /* {{{ */ { - zend_class_entry ce; - - REGISTER_MAGIC_INTERFACE(throwable, Throwable); - zend_class_implements(zend_ce_throwable, 1, zend_ce_stringable); + zend_ce_throwable = register_class_Throwable(zend_ce_stringable); + zend_ce_throwable->interface_gets_implemented = zend_implement_throwable; memcpy(&default_exception_handlers, &std_object_handlers, sizeof(zend_object_handlers)); default_exception_handlers.clone_obj = NULL; - INIT_CLASS_ENTRY(ce, "Exception", class_Exception_methods); - zend_ce_exception = zend_register_internal_class_ex(&ce, NULL); + zend_ce_exception = register_class_Exception(zend_ce_throwable); zend_ce_exception->create_object = zend_default_exception_new; - zend_class_implements(zend_ce_exception, 1, zend_ce_throwable); - declare_exception_properties(zend_ce_exception); - INIT_CLASS_ENTRY(ce, "ErrorException", class_ErrorException_methods); - zend_ce_error_exception = zend_register_internal_class_ex(&ce, zend_ce_exception); + zend_ce_error_exception = register_class_ErrorException(zend_ce_exception); zend_ce_error_exception->create_object = zend_error_exception_new; + /* Declared manually because it uses constant E_ERROR. */ zend_declare_property_long(zend_ce_error_exception, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED); - INIT_CLASS_ENTRY(ce, "Error", class_Error_methods); - zend_ce_error = zend_register_internal_class_ex(&ce, NULL); + zend_ce_error = register_class_Error(zend_ce_throwable); zend_ce_error->create_object = zend_default_exception_new; - zend_class_implements(zend_ce_error, 1, zend_ce_throwable); - declare_exception_properties(zend_ce_error); - INIT_CLASS_ENTRY(ce, "CompileError", class_CompileError_methods); - zend_ce_compile_error = zend_register_internal_class_ex(&ce, zend_ce_error); + zend_ce_compile_error = register_class_CompileError(zend_ce_error); zend_ce_compile_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ParseError", class_ParseError_methods); - zend_ce_parse_error = zend_register_internal_class_ex(&ce, zend_ce_compile_error); + zend_ce_parse_error = register_class_ParseError(zend_ce_compile_error); zend_ce_parse_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "TypeError", class_TypeError_methods); - zend_ce_type_error = zend_register_internal_class_ex(&ce, zend_ce_error); + zend_ce_type_error = register_class_TypeError(zend_ce_error); zend_ce_type_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ArgumentCountError", class_ArgumentCountError_methods); - zend_ce_argument_count_error = zend_register_internal_class_ex(&ce, zend_ce_type_error); + zend_ce_argument_count_error = register_class_ArgumentCountError(zend_ce_type_error); zend_ce_argument_count_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ValueError", class_ValueError_methods); - zend_ce_value_error = zend_register_internal_class_ex(&ce, zend_ce_error); + zend_ce_value_error = register_class_ValueError(zend_ce_error); zend_ce_value_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ArithmeticError", class_ArithmeticError_methods); - zend_ce_arithmetic_error = zend_register_internal_class_ex(&ce, zend_ce_error); + zend_ce_arithmetic_error = register_class_ArithmeticError(zend_ce_error); zend_ce_arithmetic_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "DivisionByZeroError", class_DivisionByZeroError_methods); - zend_ce_division_by_zero_error = zend_register_internal_class_ex(&ce, zend_ce_arithmetic_error); + zend_ce_division_by_zero_error = register_class_DivisionByZeroError(zend_ce_arithmetic_error); zend_ce_division_by_zero_error->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(zend_ce_unwind_exit, "UnwindExit", NULL); - - INIT_CLASS_ENTRY(ce, "UnhandledMatchError", NULL); - zend_ce_unhandled_match_error = zend_register_internal_class_ex(&ce, zend_ce_error); + zend_ce_unhandled_match_error = register_class_UnhandledMatchError(zend_ce_error); zend_ce_unhandled_match_error->create_object = zend_default_exception_new; + + INIT_CLASS_ENTRY(zend_ce_unwind_exit, "UnwindExit", NULL); } /* }}} */ diff --git a/Zend/zend_exceptions.stub.php b/Zend/zend_exceptions.stub.php index 11c1d500d3..89dff788c0 100644 --- a/Zend/zend_exceptions.stub.php +++ b/Zend/zend_exceptions.stub.php @@ -1,6 +1,9 @@ <?php -/** @generate-function-entries */ +/** + * @generate-function-entries + * @generate-class-entries + */ interface Throwable extends Stringable { @@ -22,6 +25,19 @@ interface Throwable extends Stringable class Exception implements Throwable { + /** @var string */ + protected $message = ""; + /** @var string */ + private $string = ""; + /** @var int */ + protected $code = 0; + /** @var string|null */ + protected $file = null; + /** @var int|null */ + protected $line = null; + private array $trace = []; + private ?Throwable $previous = null; + final private function __clone(): void {} public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null) {} @@ -49,13 +65,36 @@ class Exception implements Throwable class ErrorException extends Exception { - public function __construct(string $message = "", int $code = 0, int $severity = E_ERROR, ?string $filename = null, ?int $line = null, ?Throwable $previous = null) {} + /** @var int */ + protected $severity = E_ERROR; + + public function __construct( + string $message = "", + int $code = 0, + int $severity = E_ERROR, + ?string $filename = null, + ?int $line = null, + ?Throwable $previous = null + ) {} final public function getSeverity(): int {} } class Error implements Throwable { + /** @var string */ + protected $message = ""; + /** @var string */ + private $string = ""; + /** @var int */ + protected $code = 0; + /** @var string|null */ + protected $file = null; + /** @var int|null */ + protected $line = null; + private array $trace = []; + private ?Throwable $previous = null; + /** @implementation-alias Exception::__clone */ final private function __clone(): void {} @@ -123,3 +162,7 @@ class ArithmeticError extends Error class DivisionByZeroError extends ArithmeticError { } + +class UnhandledMatchError extends Error +{ +} diff --git a/Zend/zend_exceptions_arginfo.h b/Zend/zend_exceptions_arginfo.h index 5b8dab9b4d..04e3ec753b 100644 --- a/Zend/zend_exceptions_arginfo.h +++ b/Zend/zend_exceptions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3699b51b31e509c11435845c7e0d35a2608dd268 */ + * Stub hash: 053248482a00efc35be505186f8430708bd280e9 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -180,3 +180,218 @@ static const zend_function_entry class_ArithmeticError_methods[] = { static const zend_function_entry class_DivisionByZeroError_methods[] = { ZEND_FE_END }; + + +static const zend_function_entry class_UnhandledMatchError_methods[] = { + ZEND_FE_END +}; + +zend_class_entry *register_class_Throwable(zend_class_entry *class_entry_Stringable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Throwable", class_Throwable_methods); + class_entry = zend_register_internal_interface(&ce); + zend_class_implements(class_entry, 1, class_entry_Stringable); + + return class_entry; +} + +zend_class_entry *register_class_Exception(zend_class_entry *class_entry_Throwable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Exception", class_Exception_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_Throwable); + + zval property_message_default_value; + ZVAL_EMPTY_STRING(&property_message_default_value); + zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1); + zend_declare_property_ex(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_message_name); + + zval property_string_default_value; + ZVAL_EMPTY_STRING(&property_string_default_value); + zend_string *property_string_name = zend_string_init("string", sizeof("string") - 1, 1); + zend_declare_property_ex(class_entry, property_string_name, &property_string_default_value, ZEND_ACC_PRIVATE, NULL); + zend_string_release(property_string_name); + + zval property_code_default_value; + ZVAL_LONG(&property_code_default_value, 0); + zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1); + zend_declare_property_ex(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_code_name); + + zval property_file_default_value; + ZVAL_NULL(&property_file_default_value); + zend_string *property_file_name = zend_string_init("file", sizeof("file") - 1, 1); + zend_declare_property_ex(class_entry, property_file_name, &property_file_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_file_name); + + zval property_line_default_value; + ZVAL_NULL(&property_line_default_value); + zend_string *property_line_name = zend_string_init("line", sizeof("line") - 1, 1); + zend_declare_property_ex(class_entry, property_line_name, &property_line_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_line_name); + + zval property_trace_default_value; + ZVAL_EMPTY_ARRAY(&property_trace_default_value); + zend_string *property_trace_name = zend_string_init("trace", sizeof("trace") - 1, 1); + zend_declare_typed_property(class_entry, property_trace_name, &property_trace_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_trace_name); + + zend_string *property_previous_class_Throwable = zend_string_init("Throwable", sizeof("Throwable")-1, 1); + zval property_previous_default_value; + ZVAL_NULL(&property_previous_default_value); + zend_string *property_previous_name = zend_string_init("previous", sizeof("previous") - 1, 1); + zend_declare_typed_property(class_entry, property_previous_name, &property_previous_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_previous_class_Throwable, 1, 0)); + zend_string_release(property_previous_name); + + return class_entry; +} + +zend_class_entry *register_class_ErrorException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ErrorException", class_ErrorException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + +zend_class_entry *register_class_Error(zend_class_entry *class_entry_Throwable) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Error", class_Error_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + zend_class_implements(class_entry, 1, class_entry_Throwable); + + zval property_message_default_value; + ZVAL_EMPTY_STRING(&property_message_default_value); + zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1); + zend_declare_property_ex(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_message_name); + + zval property_string_default_value; + ZVAL_EMPTY_STRING(&property_string_default_value); + zend_string *property_string_name = zend_string_init("string", sizeof("string") - 1, 1); + zend_declare_property_ex(class_entry, property_string_name, &property_string_default_value, ZEND_ACC_PRIVATE, NULL); + zend_string_release(property_string_name); + + zval property_code_default_value; + ZVAL_LONG(&property_code_default_value, 0); + zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1); + zend_declare_property_ex(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_code_name); + + zval property_file_default_value; + ZVAL_NULL(&property_file_default_value); + zend_string *property_file_name = zend_string_init("file", sizeof("file") - 1, 1); + zend_declare_property_ex(class_entry, property_file_name, &property_file_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_file_name); + + zval property_line_default_value; + ZVAL_NULL(&property_line_default_value); + zend_string *property_line_name = zend_string_init("line", sizeof("line") - 1, 1); + zend_declare_property_ex(class_entry, property_line_name, &property_line_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_line_name); + + zval property_trace_default_value; + ZVAL_EMPTY_ARRAY(&property_trace_default_value); + zend_string *property_trace_name = zend_string_init("trace", sizeof("trace") - 1, 1); + zend_declare_typed_property(class_entry, property_trace_name, &property_trace_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_trace_name); + + zend_string *property_previous_class_Throwable = zend_string_init("Throwable", sizeof("Throwable")-1, 1); + zval property_previous_default_value; + ZVAL_NULL(&property_previous_default_value); + zend_string *property_previous_name = zend_string_init("previous", sizeof("previous") - 1, 1); + zend_declare_typed_property(class_entry, property_previous_name, &property_previous_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_previous_class_Throwable, 1, 0)); + zend_string_release(property_previous_name); + + return class_entry; +} + +zend_class_entry *register_class_CompileError(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "CompileError", class_CompileError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} + +zend_class_entry *register_class_ParseError(zend_class_entry *class_entry_CompileError) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ParseError", class_ParseError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_CompileError); + + return class_entry; +} + +zend_class_entry *register_class_TypeError(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "TypeError", class_TypeError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} + +zend_class_entry *register_class_ArgumentCountError(zend_class_entry *class_entry_TypeError) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ArgumentCountError", class_ArgumentCountError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_TypeError); + + return class_entry; +} + +zend_class_entry *register_class_ValueError(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ValueError", class_ValueError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} + +zend_class_entry *register_class_ArithmeticError(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ArithmeticError", class_ArithmeticError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} + +zend_class_entry *register_class_DivisionByZeroError(zend_class_entry *class_entry_ArithmeticError) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "DivisionByZeroError", class_DivisionByZeroError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_ArithmeticError); + + return class_entry; +} + +zend_class_entry *register_class_UnhandledMatchError(zend_class_entry *class_entry_Error) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "UnhandledMatchError", class_UnhandledMatchError_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Error); + + return class_entry; +} + diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 4e6f1d4bbd..df94446d6f 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -1112,17 +1112,11 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob void zend_register_generator_ce(void) /* {{{ */ { - zend_class_entry ce; - - INIT_CLASS_ENTRY(ce, "Generator", class_Generator_methods); - zend_ce_generator = zend_register_internal_class(&ce); - zend_ce_generator->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES; + zend_ce_generator = register_class_Generator(zend_ce_iterator); zend_ce_generator->create_object = zend_generator_create; zend_ce_generator->serialize = zend_class_serialize_deny; zend_ce_generator->unserialize = zend_class_unserialize_deny; - /* get_iterator has to be assigned *after* implementing the interface */ - zend_class_implements(zend_ce_generator, 1, zend_ce_iterator); zend_ce_generator->get_iterator = zend_generator_get_iterator; memcpy(&zend_generator_handlers, &std_object_handlers, sizeof(zend_object_handlers)); @@ -1132,7 +1126,6 @@ void zend_register_generator_ce(void) /* {{{ */ zend_generator_handlers.clone_obj = NULL; zend_generator_handlers.get_constructor = zend_generator_get_constructor; - INIT_CLASS_ENTRY(ce, "ClosedGeneratorException", NULL); - zend_ce_ClosedGeneratorException = zend_register_internal_class_ex(&ce, zend_ce_exception); + zend_ce_ClosedGeneratorException = register_class_ClosedGeneratorException(zend_ce_exception); } /* }}} */ diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php index f2e47616ba..879fdb3642 100644 --- a/Zend/zend_generators.stub.php +++ b/Zend/zend_generators.stub.php @@ -1,7 +1,11 @@ <?php -/** @generate-function-entries */ +/** + * @generate-function-entries + * @generate-class-entries + */ +/** @strict-properties */ final class Generator implements Iterator { public function rewind(): void {} @@ -20,3 +24,7 @@ final class Generator implements Iterator public function getReturn(): mixed {} } + +class ClosedGeneratorException extends Exception +{ +} diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h index 22084d9feb..c4384a770e 100644 --- a/Zend/zend_generators_arginfo.h +++ b/Zend/zend_generators_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 18d2bb68729ff622a5c0c124a8822f7ee882c2ec */ + * Stub hash: 9d6c2801abbb78d402efb2b2ccdd5242438bd6a1 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() @@ -46,3 +46,31 @@ static const zend_function_entry class_Generator_methods[] = { ZEND_ME(Generator, getReturn, arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC) ZEND_FE_END }; + + +static const zend_function_entry class_ClosedGeneratorException_methods[] = { + ZEND_FE_END +}; + +zend_class_entry *register_class_Generator(zend_class_entry *class_entry_Iterator) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "Generator", class_Generator_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; + zend_class_implements(class_entry, 1, class_entry_Iterator); + + return class_entry; +} + +zend_class_entry *register_class_ClosedGeneratorException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "ClosedGeneratorException", class_ClosedGeneratorException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + |