diff options
-rw-r--r-- | Zend/zend_exceptions.c | 91 | ||||
-rw-r--r-- | Zend/zend_exceptions.stub.php | 90 | ||||
-rw-r--r-- | Zend/zend_exceptions_arginfo.h | 144 | ||||
-rw-r--r-- | Zend/zend_generators.c | 14 | ||||
-rw-r--r-- | Zend/zend_generators.stub.php | 2 | ||||
-rw-r--r-- | Zend/zend_generators_arginfo.h | 23 | ||||
-rw-r--r-- | Zend/zend_interfaces.c | 48 | ||||
-rw-r--r-- | Zend/zend_interfaces.h | 2 | ||||
-rw-r--r-- | Zend/zend_interfaces.stub.php | 2 | ||||
-rw-r--r-- | Zend/zend_interfaces_arginfo.h | 51 | ||||
-rw-r--r-- | Zend/zend_weakrefs.c | 20 | ||||
-rw-r--r-- | Zend/zend_weakrefs.stub.php | 26 | ||||
-rw-r--r-- | Zend/zend_weakrefs_arginfo.h | 28 | ||||
-rw-r--r-- | sapi/cli/tests/005.phpt | 8 |
14 files changed, 368 insertions, 181 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 60893095ae..4fc283755c 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -258,7 +258,7 @@ static zend_object *zend_error_exception_new(zend_class_entry *class_type) /* {{ /* {{{ proto Exception|Error Exception|Error::__clone() Clone the exception object */ -ZEND_COLD ZEND_METHOD(exception, __clone) +ZEND_COLD ZEND_METHOD(Exception, __clone) { /* Should never be executable */ zend_throw_exception(NULL, "Cannot clone object using __clone()", 0); @@ -267,7 +267,7 @@ ZEND_COLD ZEND_METHOD(exception, __clone) /* {{{ proto Exception|Error::__construct(string message, int code [, Throwable previous]) Exception constructor */ -ZEND_METHOD(exception, __construct) +ZEND_METHOD(Exception, __construct) { zend_string *message = NULL; zend_long code = 0; @@ -305,7 +305,7 @@ ZEND_METHOD(exception, __construct) zend_unset_property(i_get_exception_base(object), object, ZSTR_VAL(ZSTR_KNOWN(id)), ZSTR_LEN(ZSTR_KNOWN(id))); \ } -ZEND_METHOD(exception, __wakeup) +ZEND_METHOD(Exception, __wakeup) { zval value, *pvalue; zval *object = ZEND_THIS; @@ -326,7 +326,7 @@ ZEND_METHOD(exception, __wakeup) /* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Throwable previous]]]) ErrorException constructor */ -ZEND_METHOD(error_exception, __construct) +ZEND_METHOD(ErrorException, __construct) { zend_string *message = NULL, *filename = NULL; zend_long code = 0, severity = E_ERROR, lineno; @@ -377,7 +377,7 @@ ZEND_METHOD(error_exception, __construct) /* {{{ proto string Exception|Error::getFile() Get the file in which the exception occurred */ -ZEND_METHOD(exception, getFile) +ZEND_METHOD(Exception, getFile) { zval *prop, rv; @@ -391,7 +391,7 @@ ZEND_METHOD(exception, getFile) /* {{{ proto int Exception|Error::getLine() Get the line in which the exception occurred */ -ZEND_METHOD(exception, getLine) +ZEND_METHOD(Exception, getLine) { zval *prop, rv; @@ -405,7 +405,7 @@ ZEND_METHOD(exception, getLine) /* {{{ proto string Exception|Error::getMessage() Get the exception message */ -ZEND_METHOD(exception, getMessage) +ZEND_METHOD(Exception, getMessage) { zval *prop, rv; @@ -419,7 +419,7 @@ ZEND_METHOD(exception, getMessage) /* {{{ proto int Exception|Error::getCode() Get the exception code */ -ZEND_METHOD(exception, getCode) +ZEND_METHOD(Exception, getCode) { zval *prop, rv; @@ -433,7 +433,7 @@ ZEND_METHOD(exception, getCode) /* {{{ proto array Exception|Error::getTrace() Get the stack trace for the location in which the exception occurred */ -ZEND_METHOD(exception, getTrace) +ZEND_METHOD(Exception, getTrace) { zval *prop, rv; @@ -447,7 +447,7 @@ ZEND_METHOD(exception, getTrace) /* {{{ proto int ErrorException::getSeverity() Get the exception severity */ -ZEND_METHOD(error_exception, getSeverity) +ZEND_METHOD(ErrorException, getSeverity) { zval *prop, rv; @@ -590,7 +590,7 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /* /* {{{ proto string Exception|Error::getTraceAsString() Obtain the backtrace for the exception as a string (instead of an array) */ -ZEND_METHOD(exception, getTraceAsString) +ZEND_METHOD(Exception, getTraceAsString) { zval *trace, *frame, rv; zend_ulong index; @@ -629,7 +629,7 @@ ZEND_METHOD(exception, getTraceAsString) /* {{{ proto Throwable Exception|Error::getPrevious() Return previous Throwable or NULL. */ -ZEND_METHOD(exception, getPrevious) +ZEND_METHOD(Exception, getPrevious) { zval rv; @@ -640,7 +640,7 @@ ZEND_METHOD(exception, getPrevious) /* {{{ proto string Exception|Error::__toString() Obtain the string representation of the Exception object */ -ZEND_METHOD(exception, __toString) +ZEND_METHOD(Exception, __toString) { zval trace, *exception; zend_class_entry *base_ce; @@ -733,51 +733,6 @@ ZEND_METHOD(exception, __toString) } /* }}} */ -/** {{{ Throwable method definition */ -static const zend_function_entry zend_funcs_throwable[] = { - ZEND_ABSTRACT_ME(throwable, getMessage, arginfo_class_Throwable_getMessage) - ZEND_ABSTRACT_ME(throwable, getCode, arginfo_class_Throwable_getCode) - ZEND_ABSTRACT_ME(throwable, getFile, arginfo_class_Throwable_getFile) - ZEND_ABSTRACT_ME(throwable, getLine, arginfo_class_Throwable_getLine) - ZEND_ABSTRACT_ME(throwable, getTrace, arginfo_class_Throwable_getTrace) - ZEND_ABSTRACT_ME(throwable, getPrevious, arginfo_class_Throwable_getPrevious) - ZEND_ABSTRACT_ME(throwable, getTraceAsString, arginfo_class_Throwable_getTraceAsString) - ZEND_FE_END -}; -/* }}} */ - -/* {{{ internal structs */ -/* All functions that may be used in uncaught exception handlers must be final - * and must not throw exceptions. Otherwise we would need a facility to handle - * such exceptions in that handler. - * Also all getXY() methods are final because thy serve as read only access to - * their corresponding properties, no more, no less. If after all you need to - * override something then it is method __toString(). - * And never try to change the state of exceptions and never implement anything - * that gives the user anything to accomplish this. - */ -static const zend_function_entry default_exception_functions[] = { - ZEND_ME(exception, __clone, arginfo_class_Exception___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_ME(exception, __construct, arginfo_class_Exception___construct, ZEND_ACC_PUBLIC) - ZEND_ME(exception, __wakeup, arginfo_class_Exception___wakeup, ZEND_ACC_PUBLIC) - ZEND_ME(exception, getMessage, arginfo_class_Exception_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, getCode, arginfo_class_Exception_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, getFile, arginfo_class_Exception_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, getLine, arginfo_class_Exception_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, getTrace, arginfo_class_Exception_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, getPrevious, arginfo_class_Exception_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, getTraceAsString, arginfo_class_Exception_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(exception, __toString, arginfo_class_Exception___toString, 0) - ZEND_FE_END -}; - -static const zend_function_entry error_exception_functions[] = { - ZEND_ME(error_exception, __construct, arginfo_class_ErrorException___construct, ZEND_ACC_PUBLIC) - ZEND_ME(error_exception, getSeverity, arginfo_class_ErrorException_getSeverity, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_FE_END -}; -/* }}} */ - void zend_register_default_exception(void) /* {{{ */ { zend_class_entry ce; @@ -788,7 +743,7 @@ void zend_register_default_exception(void) /* {{{ */ memcpy(&default_exception_handlers, &std_object_handlers, sizeof(zend_object_handlers)); default_exception_handlers.clone_obj = NULL; - INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions); + INIT_CLASS_ENTRY(ce, "Exception", class_Exception_methods); zend_ce_exception = zend_register_internal_class_ex(&ce, NULL); zend_ce_exception->create_object = zend_default_exception_new; zend_class_implements(zend_ce_exception, 1, zend_ce_throwable); @@ -801,12 +756,12 @@ void zend_register_default_exception(void) /* {{{ */ zend_declare_property_null(zend_ce_exception, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE); zend_declare_property_null(zend_ce_exception, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE); - INIT_CLASS_ENTRY(ce, "ErrorException", error_exception_functions); + 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->create_object = zend_error_exception_new; zend_declare_property_long(zend_ce_error_exception, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED); - INIT_CLASS_ENTRY(ce, "Error", default_exception_functions); + INIT_CLASS_ENTRY(ce, "Error", class_Error_methods); zend_ce_error = zend_register_internal_class_ex(&ce, NULL); zend_ce_error->create_object = zend_default_exception_new; zend_class_implements(zend_ce_error, 1, zend_ce_throwable); @@ -819,31 +774,31 @@ void zend_register_default_exception(void) /* {{{ */ zend_declare_property_null(zend_ce_error, "trace", sizeof("trace")-1, ZEND_ACC_PRIVATE); zend_declare_property_null(zend_ce_error, "previous", sizeof("previous")-1, ZEND_ACC_PRIVATE); - INIT_CLASS_ENTRY(ce, "CompileError", NULL); + 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->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ParseError", NULL); + 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->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "TypeError", NULL); + 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->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ArgumentCountError", NULL); + 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->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ValueError", NULL); + 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->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "ArithmeticError", NULL); + 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->create_object = zend_default_exception_new; - INIT_CLASS_ENTRY(ce, "DivisionByZeroError", NULL); + 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->create_object = zend_default_exception_new; } diff --git a/Zend/zend_exceptions.stub.php b/Zend/zend_exceptions.stub.php index 83e3a3ba45..c467f36ecb 100644 --- a/Zend/zend_exceptions.stub.php +++ b/Zend/zend_exceptions.stub.php @@ -1,5 +1,7 @@ <?php +/** @generate-function-entries */ + interface Throwable extends Stringable { /** @return string */ @@ -32,26 +34,20 @@ class Exception implements Throwable public function __wakeup() {} - /** @return string */ - final public function getMessage() {} + final public function getMessage(): string {} /** @return int */ final public function getCode() {} - /** @return string */ - final public function getFile() {} + final public function getFile(): string {} - /** @return int */ - final public function getLine() {} + final public function getLine(): int {} - /** @return array */ - final public function getTrace() {} + final public function getTrace(): array {} - /** @return ?Throwable */ - final public function getPrevious() {} + final public function getPrevious(): ?Throwable {} - /** @return string */ - final public function getTraceAsString() {} + final public function getTraceAsString(): string {} public function __toString(): string {} } @@ -60,6 +56,72 @@ class ErrorException extends Exception { public function __construct(string $message = UNKNOWN, int $code = 0, int $severity = E_ERROR, string $filename = UNKNOWN, int $lineno = 0, ?Throwable $previous = null) {} - /** @return int */ - final public function getSeverity() {} + final public function getSeverity(): int {} +} + +class Error implements Throwable +{ + /** @alias Exception::__clone */ + final private function __clone() {} + + /** @alias Exception::__construct */ + public function __construct(string $message = UNKNOWN, int $code = 0, ?Throwable $previous = null) {} + + /** @alias Exception::__wakeup */ + public function __wakeup() {} + + /** @alias Exception::getMessage */ + final public function getMessage(): string {} + + /** + * @return int + * @alias Exception::getCode + */ + final public function getCode() {} + + /** @alias Exception::getFile */ + final public function getFile(): string {} + + /** @alias Exception::getLine */ + final public function getLine(): int {} + + /** @alias Exception::getTrace */ + final public function getTrace(): array {} + + /** @alias Exception::getPrevious */ + final public function getPrevious(): ?Throwable {} + + /** @alias Exception::getTraceAsString */ + final public function getTraceAsString(): string {} + + /** @alias Exception::__toString */ + public function __toString(): string {} +} + +class CompileError extends Error +{ +} + +class ParseError extends CompileError +{ +} + +class TypeError extends Error +{ +} + +class ArgumentCountError extends TypeError +{ +} + +class ValueError extends Error +{ +} + +class ArithmeticError extends Error +{ +} + +class DivisionByZeroError extends ArithmeticError +{ } diff --git a/Zend/zend_exceptions_arginfo.h b/Zend/zend_exceptions_arginfo.h index b264a925dd..3f8ceb833b 100644 --- a/Zend/zend_exceptions_arginfo.h +++ b/Zend/zend_exceptions_arginfo.h @@ -25,22 +25,25 @@ ZEND_END_ARG_INFO() #define arginfo_class_Exception___wakeup arginfo_class_Throwable_getMessage -#define arginfo_class_Exception_getMessage arginfo_class_Throwable_getMessage +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Exception_getMessage, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() #define arginfo_class_Exception_getCode arginfo_class_Throwable_getMessage -#define arginfo_class_Exception_getFile arginfo_class_Throwable_getMessage +#define arginfo_class_Exception_getFile arginfo_class_Exception_getMessage -#define arginfo_class_Exception_getLine arginfo_class_Throwable_getMessage +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Exception_getLine, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() -#define arginfo_class_Exception_getTrace arginfo_class_Throwable_getMessage +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Exception_getTrace, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() -#define arginfo_class_Exception_getPrevious arginfo_class_Throwable_getMessage +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Exception_getPrevious, 0, 0, Throwable, 1) +ZEND_END_ARG_INFO() -#define arginfo_class_Exception_getTraceAsString arginfo_class_Throwable_getMessage +#define arginfo_class_Exception_getTraceAsString arginfo_class_Exception_getMessage -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Exception___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() +#define arginfo_class_Exception___toString arginfo_class_Exception_getMessage ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ErrorException___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) @@ -51,4 +54,127 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ErrorException___construct, 0, 0, 0) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, previous, Throwable, 1, "null") ZEND_END_ARG_INFO() -#define arginfo_class_ErrorException_getSeverity arginfo_class_Throwable_getMessage +#define arginfo_class_ErrorException_getSeverity arginfo_class_Exception_getLine + +#define arginfo_class_Error___clone arginfo_class_Throwable_getMessage + +#define arginfo_class_Error___construct arginfo_class_Exception___construct + +#define arginfo_class_Error___wakeup arginfo_class_Throwable_getMessage + +#define arginfo_class_Error_getMessage arginfo_class_Exception_getMessage + +#define arginfo_class_Error_getCode arginfo_class_Throwable_getMessage + +#define arginfo_class_Error_getFile arginfo_class_Exception_getMessage + +#define arginfo_class_Error_getLine arginfo_class_Exception_getLine + +#define arginfo_class_Error_getTrace arginfo_class_Exception_getTrace + +#define arginfo_class_Error_getPrevious arginfo_class_Exception_getPrevious + +#define arginfo_class_Error_getTraceAsString arginfo_class_Exception_getMessage + +#define arginfo_class_Error___toString arginfo_class_Exception_getMessage + + +ZEND_METHOD(Exception, __clone); +ZEND_METHOD(Exception, __construct); +ZEND_METHOD(Exception, __wakeup); +ZEND_METHOD(Exception, getMessage); +ZEND_METHOD(Exception, getCode); +ZEND_METHOD(Exception, getFile); +ZEND_METHOD(Exception, getLine); +ZEND_METHOD(Exception, getTrace); +ZEND_METHOD(Exception, getPrevious); +ZEND_METHOD(Exception, getTraceAsString); +ZEND_METHOD(Exception, __toString); +ZEND_METHOD(ErrorException, __construct); +ZEND_METHOD(ErrorException, getSeverity); + + +static const zend_function_entry class_Throwable_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getMessage, arginfo_class_Throwable_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getCode, arginfo_class_Throwable_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getFile, arginfo_class_Throwable_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getLine, arginfo_class_Throwable_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getTrace, arginfo_class_Throwable_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getPrevious, arginfo_class_Throwable_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Throwable, getTraceAsString, arginfo_class_Throwable_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_Exception_methods[] = { + ZEND_ME(Exception, __clone, arginfo_class_Exception___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(Exception, __construct, arginfo_class_Exception___construct, ZEND_ACC_PUBLIC) + ZEND_ME(Exception, __wakeup, arginfo_class_Exception___wakeup, ZEND_ACC_PUBLIC) + ZEND_ME(Exception, getMessage, arginfo_class_Exception_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, getCode, arginfo_class_Exception_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, getFile, arginfo_class_Exception_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, getLine, arginfo_class_Exception_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, getTrace, arginfo_class_Exception_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, getPrevious, arginfo_class_Exception_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, getTraceAsString, arginfo_class_Exception_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(Exception, __toString, arginfo_class_Exception___toString, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_ErrorException_methods[] = { + ZEND_ME(ErrorException, __construct, arginfo_class_ErrorException___construct, ZEND_ACC_PUBLIC) + ZEND_ME(ErrorException, getSeverity, arginfo_class_ErrorException_getSeverity, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + + +static const zend_function_entry class_Error_methods[] = { + ZEND_MALIAS(Exception, __clone, __clone, arginfo_class_Error___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, __construct, __construct, arginfo_class_Error___construct, ZEND_ACC_PUBLIC) + ZEND_MALIAS(Exception, __wakeup, __wakeup, arginfo_class_Error___wakeup, ZEND_ACC_PUBLIC) + ZEND_MALIAS(Exception, getMessage, getMessage, arginfo_class_Error_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, getCode, getCode, arginfo_class_Error_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, getFile, getFile, arginfo_class_Error_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, getLine, getLine, arginfo_class_Error_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, getTrace, getTrace, arginfo_class_Error_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, getPrevious, getPrevious, arginfo_class_Error_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, getTraceAsString, getTraceAsString, arginfo_class_Error_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_MALIAS(Exception, __toString, __toString, arginfo_class_Error___toString, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_CompileError_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_ParseError_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_TypeError_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_ArgumentCountError_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_ValueError_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_ArithmeticError_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_DivisionByZeroError_methods[] = { + ZEND_FE_END +}; diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 7bb35384d2..b3261842eb 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -1189,23 +1189,11 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob } /* }}} */ -static const zend_function_entry generator_functions[] = { - ZEND_ME(Generator, rewind, arginfo_class_Generator_rewind, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, valid, arginfo_class_Generator_valid, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, current, arginfo_class_Generator_current, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, key, arginfo_class_Generator_key, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, next, arginfo_class_Generator_next, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, send, arginfo_class_Generator_send, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, throw, arginfo_class_Generator_throw, ZEND_ACC_PUBLIC) - ZEND_ME(Generator, getReturn,arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - void zend_register_generator_ce(void) /* {{{ */ { zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "Generator", generator_functions); + 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_ce_generator->create_object = zend_generator_create; diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php index 7f45f726b5..5fb485895c 100644 --- a/Zend/zend_generators.stub.php +++ b/Zend/zend_generators.stub.php @@ -1,5 +1,7 @@ <?php +/** @generate-function-entries */ + final class Generator implements Iterator { public function rewind(): void {} diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h index a65d6b1b12..214595e580 100644 --- a/Zend/zend_generators_arginfo.h +++ b/Zend/zend_generators_arginfo.h @@ -22,3 +22,26 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_throw, 0, 0, 1) ZEND_END_ARG_INFO() #define arginfo_class_Generator_getReturn arginfo_class_Generator_current + + +ZEND_METHOD(Generator, rewind); +ZEND_METHOD(Generator, valid); +ZEND_METHOD(Generator, current); +ZEND_METHOD(Generator, key); +ZEND_METHOD(Generator, next); +ZEND_METHOD(Generator, send); +ZEND_METHOD(Generator, throw); +ZEND_METHOD(Generator, getReturn); + + +static const zend_function_entry class_Generator_methods[] = { + ZEND_ME(Generator, rewind, arginfo_class_Generator_rewind, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, valid, arginfo_class_Generator_valid, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, current, arginfo_class_Generator_current, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, key, arginfo_class_Generator_key, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, next, arginfo_class_Generator_next, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, send, arginfo_class_Generator_send, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, throw, arginfo_class_Generator_throw, ZEND_ACC_PUBLIC) + ZEND_ME(Generator, getReturn, arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index acebe0a1fb..8fffde76ff 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -484,48 +484,6 @@ static int zend_implement_serializable(zend_class_entry *interface, zend_class_e } /* }}}*/ -/* {{{ function tables */ -static const zend_function_entry zend_funcs_aggregate[] = { - ZEND_ABSTRACT_ME(iterator, getIterator, arginfo_class_IteratorAggregate_getIterator) - ZEND_FE_END -}; - -static const zend_function_entry zend_funcs_iterator[] = { - ZEND_ABSTRACT_ME(iterator, current, arginfo_class_Iterator_current) - ZEND_ABSTRACT_ME(iterator, next, arginfo_class_Iterator_next) - ZEND_ABSTRACT_ME(iterator, key, arginfo_class_Iterator_key) - ZEND_ABSTRACT_ME(iterator, valid, arginfo_class_Iterator_valid) - ZEND_ABSTRACT_ME(iterator, rewind, arginfo_class_Iterator_rewind) - ZEND_FE_END -}; - -static const zend_function_entry *zend_funcs_traversable = NULL; - -static const zend_function_entry zend_funcs_arrayaccess[] = { - ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_class_ArrayAccess_offsetExists) - ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_class_ArrayAccess_offsetGet) - ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_class_ArrayAccess_offsetSet) - ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_class_ArrayAccess_offsetUnset) - ZEND_FE_END -}; - -static const zend_function_entry zend_funcs_serializable[] = { - ZEND_ABSTRACT_ME(serializable, serialize, arginfo_class_Serializable_serialize) - ZEND_FENTRY(unserialize, NULL, arginfo_class_Serializable_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) - ZEND_FE_END -}; - -static const zend_function_entry zend_funcs_countable[] = { - ZEND_ABSTRACT_ME(Countable, count, arginfo_class_Countable_count) - ZEND_FE_END -}; - -static const zend_function_entry zend_funcs_stringable[] = { - ZEND_ABSTRACT_ME(Stringable, __toString, arginfo_class_Stringable___toString) - ZEND_FE_END -}; -/* }}} */ - /* {{{ zend_register_interfaces */ ZEND_API void zend_register_interfaces(void) { @@ -540,13 +498,13 @@ ZEND_API void zend_register_interfaces(void) REGISTER_MAGIC_INTERFACE(serializable, Serializable); zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "ArrayAccess", zend_funcs_arrayaccess); + INIT_CLASS_ENTRY(ce, "ArrayAccess", class_ArrayAccess_methods); zend_ce_arrayaccess = zend_register_internal_interface(&ce); - INIT_CLASS_ENTRY(ce, "Countable", zend_funcs_countable); + INIT_CLASS_ENTRY(ce, "Countable", class_Countable_methods); zend_ce_countable = zend_register_internal_interface(&ce); - INIT_CLASS_ENTRY(ce, "Stringable", zend_funcs_stringable); + INIT_CLASS_ENTRY(ce, "Stringable", class_Stringable_methods); zend_ce_stringable = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index c79495eca3..dbdcd2a074 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -52,7 +52,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z #define REGISTER_MAGIC_INTERFACE(class_name, class_name_str) \ {\ zend_class_entry ce;\ - INIT_CLASS_ENTRY(ce, # class_name_str, zend_funcs_ ## class_name) \ + INIT_CLASS_ENTRY(ce, # class_name_str, class_ ## class_name_str ## _methods) \ zend_ce_ ## class_name = zend_register_internal_interface(&ce);\ zend_ce_ ## class_name->interface_gets_implemented = zend_implement_ ## class_name;\ } diff --git a/Zend/zend_interfaces.stub.php b/Zend/zend_interfaces.stub.php index 1deb28a384..2865aace08 100644 --- a/Zend/zend_interfaces.stub.php +++ b/Zend/zend_interfaces.stub.php @@ -1,5 +1,7 @@ <?php +/** @generate-function-entries */ + interface Traversable {} interface IteratorAggregate extends Traversable diff --git a/Zend/zend_interfaces_arginfo.h b/Zend/zend_interfaces_arginfo.h index e96104719a..c8f78ce3bd 100644 --- a/Zend/zend_interfaces_arginfo.h +++ b/Zend/zend_interfaces_arginfo.h @@ -36,3 +36,54 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Stringable___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() + + + + +static const zend_function_entry class_Traversable_methods[] = { + ZEND_FE_END +}; + + +static const zend_function_entry class_IteratorAggregate_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(IteratorAggregate, getIterator, arginfo_class_IteratorAggregate_getIterator, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_Iterator_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(Iterator, current, arginfo_class_Iterator_current, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Iterator, next, arginfo_class_Iterator_next, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Iterator, key, arginfo_class_Iterator_key, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Iterator, valid, arginfo_class_Iterator_valid, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Iterator, rewind, arginfo_class_Iterator_rewind, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_ArrayAccess_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(ArrayAccess, offsetExists, arginfo_class_ArrayAccess_offsetExists, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(ArrayAccess, offsetGet, arginfo_class_ArrayAccess_offsetGet, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(ArrayAccess, offsetSet, arginfo_class_ArrayAccess_offsetSet, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(ArrayAccess, offsetUnset, arginfo_class_ArrayAccess_offsetUnset, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_Serializable_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(Serializable, serialize, arginfo_class_Serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(Serializable, unserialize, arginfo_class_Serializable_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_Countable_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(Countable, count, arginfo_class_Countable_count, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_Stringable_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(Stringable, __toString, arginfo_class_Stringable___toString, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index c3f7bf5bb2..db5ffde2fd 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -298,13 +298,6 @@ ZEND_METHOD(WeakReference, get) zend_weakref_get(getThis(), return_value); } -static const zend_function_entry zend_weakref_methods[] = { - ZEND_ME(WeakReference, __construct, arginfo_class_WeakReference___construct, ZEND_ACC_PUBLIC) - ZEND_ME(WeakReference, create, arginfo_class_WeakReference_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - ZEND_ME(WeakReference, get, arginfo_class_WeakReference_get, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - static zend_object *zend_weakmap_create_object(zend_class_entry *ce) { zend_weakmap *wm = zend_object_alloc(sizeof(zend_weakmap), ce); @@ -620,20 +613,11 @@ ZEND_METHOD(WeakMap, count) RETURN_LONG(count); } -static const zend_function_entry zend_weakmap_methods[] = { - ZEND_ME(WeakMap, offsetGet, arginfo_class_WeakMap_offsetGet, ZEND_ACC_PUBLIC) - ZEND_ME(WeakMap, offsetSet, arginfo_class_WeakMap_offsetSet, ZEND_ACC_PUBLIC) - ZEND_ME(WeakMap, offsetExists, arginfo_class_WeakMap_offsetExists, ZEND_ACC_PUBLIC) - ZEND_ME(WeakMap, offsetUnset, arginfo_class_WeakMap_offsetUnset, ZEND_ACC_PUBLIC) - ZEND_ME(WeakMap, count, arginfo_class_WeakMap_count, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - void zend_register_weakref_ce(void) /* {{{ */ { zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "WeakReference", zend_weakref_methods); + INIT_CLASS_ENTRY(ce, "WeakReference", class_WeakReference_methods); zend_ce_weakref = zend_register_internal_class(&ce); zend_ce_weakref->ce_flags |= ZEND_ACC_FINAL; @@ -652,7 +636,7 @@ void zend_register_weakref_ce(void) /* {{{ */ zend_weakref_handlers.get_property_ptr_ptr = zend_weakref_no_read_ptr; zend_weakref_handlers.clone_obj = NULL; - INIT_CLASS_ENTRY(ce, "WeakMap", zend_weakmap_methods); + INIT_CLASS_ENTRY(ce, "WeakMap", class_WeakMap_methods); zend_ce_weakmap = zend_register_internal_class(&ce); zend_ce_weakmap->ce_flags |= ZEND_ACC_FINAL; diff --git a/Zend/zend_weakrefs.stub.php b/Zend/zend_weakrefs.stub.php index aada11bc79..4cf189b064 100644 --- a/Zend/zend_weakrefs.stub.php +++ b/Zend/zend_weakrefs.stub.php @@ -1,33 +1,35 @@ <?php -final class WeakReference { - public function __construct(); +/** @generate-function-entries */ - public static function create(): WeakReference; +final class WeakReference +{ + public function __construct() {} - public function get(): ?object; -} + public static function create(): WeakReference {} -final class WeakMap implements ArrayAccess, Countable, Traversable { - //public function __construct(); + public function get(): ?object {} +} +final class WeakMap implements ArrayAccess, Countable, Traversable +{ /** * @param object $object * @return mixed */ - public function offsetGet($object); + public function offsetGet($object) {} /** * @param object $object * @param mixed $value */ - public function offsetSet($object, $value): void; + public function offsetSet($object, $value): void {} /** @param object $object */ - public function offsetExists($object): bool; + public function offsetExists($object): bool {} /** @param object $object */ - public function offsetUnset($object): void; + public function offsetUnset($object): void {} - public function count(): int; + public function count(): int {} } diff --git a/Zend/zend_weakrefs_arginfo.h b/Zend/zend_weakrefs_arginfo.h index b10c1b63b5..4451635251 100644 --- a/Zend/zend_weakrefs_arginfo.h +++ b/Zend/zend_weakrefs_arginfo.h @@ -28,3 +28,31 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() + + +ZEND_METHOD(WeakReference, __construct); +ZEND_METHOD(WeakReference, create); +ZEND_METHOD(WeakReference, get); +ZEND_METHOD(WeakMap, offsetGet); +ZEND_METHOD(WeakMap, offsetSet); +ZEND_METHOD(WeakMap, offsetExists); +ZEND_METHOD(WeakMap, offsetUnset); +ZEND_METHOD(WeakMap, count); + + +static const zend_function_entry class_WeakReference_methods[] = { + ZEND_ME(WeakReference, __construct, arginfo_class_WeakReference___construct, ZEND_ACC_PUBLIC) + ZEND_ME(WeakReference, create, arginfo_class_WeakReference_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(WeakReference, get, arginfo_class_WeakReference_get, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_WeakMap_methods[] = { + ZEND_ME(WeakMap, offsetGet, arginfo_class_WeakMap_offsetGet, ZEND_ACC_PUBLIC) + ZEND_ME(WeakMap, offsetSet, arginfo_class_WeakMap_offsetSet, ZEND_ACC_PUBLIC) + ZEND_ME(WeakMap, offsetExists, arginfo_class_WeakMap_offsetExists, ZEND_ACC_PUBLIC) + ZEND_ME(WeakMap, offsetUnset, arginfo_class_WeakMap_offsetUnset, ZEND_ACC_PUBLIC) + ZEND_ME(WeakMap, count, arginfo_class_WeakMap_count, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt index 51b957dd7b..530b6cf29b 100644 --- a/sapi/cli/tests/005.phpt +++ b/sapi/cli/tests/005.phpt @@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] { } " -string(2003) "Class [ <internal:Core> class Exception implements Throwable, Stringable ] { +string(2159) "Class [ <internal:Core> class Exception implements Throwable, Stringable ] { - Constants [0] { } @@ -84,6 +84,7 @@ string(2003) "Class [ <internal:Core> class Exception implements Throwable, Stri - Parameters [0] { } + - Return [ string ] } Method [ <internal:Core, prototype Throwable> final public method getCode ] { @@ -96,30 +97,35 @@ string(2003) "Class [ <internal:Core> class Exception implements Throwable, Stri - Parameters [0] { } + - Return [ string ] } Method [ <internal:Core, prototype Throwable> final public method getLine ] { - Parameters [0] { } + - Return [ int ] } Method [ <internal:Core, prototype Throwable> final public method getTrace ] { - Parameters [0] { } + - Return [ array ] } Method [ <internal:Core, prototype Throwable> final public method getPrevious ] { - Parameters [0] { } + - Return [ ?Throwable ] } Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] { - Parameters [0] { } + - Return [ string ] } Method [ <internal:Core, prototype Stringable> public method __toString ] { |