diff --git a/.gitignore b/.gitignore index 625612e..8d74c2c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ acinclude.m4 aclocal.m4 autom4te.cache build +confdefs.h config.guess config.h config.h.in diff --git a/config.m4 b/config.m4 index f0bbc84..27af960 100644 --- a/config.m4 +++ b/config.m4 @@ -161,7 +161,7 @@ if test "$PHP_V8" != "no"; then v8.cc \ src/php_v8_a.cc \ src/php_v8_enums.cc \ - src/php_v8_exception.cc \ + src/php_v8_exception_manager.cc \ src/php_v8_ext_mem_interface.cc \ src/php_v8_try_catch.cc \ src/php_v8_message.cc \ diff --git a/package.xml b/package.xml index 17ad1f2..1579db0 100644 --- a/package.xml +++ b/package.xml @@ -71,7 +71,7 @@ - + diff --git a/php_v8.h b/php_v8.h index 373e03c..b569690 100644 --- a/php_v8.h +++ b/php_v8.h @@ -76,6 +76,9 @@ ZEND_END_MODULE_GLOBALS(v8) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, NULL, allow_null) #endif +#define PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(name, required_num_args) ZEND_BEGIN_ARG_INFO_EX(name, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, required_num_args) +#define PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(name, required_num_args) ZEND_BEGIN_ARG_INFO_EX(name, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, required_num_args) + #define PHP_V8_IS_UP_AND_RUNNING() (zend_is_executing() && !CG(unclean_shutdown)) #define PHP_V8_ME(classname, name, flags) PHP_ME(classname, name, arginfo_##name, flags) diff --git a/src/php_v8_array.cc b/src/php_v8_array.cc index 27140f5..e9fc006 100644 --- a/src/php_v8_array.cc +++ b/src/php_v8_array.cc @@ -60,7 +60,7 @@ static PHP_METHOD(Array, length) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_boolean.cc b/src/php_v8_boolean.cc index 1aeee87..9316b07 100644 --- a/src/php_v8_boolean.cc +++ b/src/php_v8_boolean.cc @@ -55,7 +55,7 @@ static PHP_METHOD(BooleanValue, value) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_boolean_object.cc b/src/php_v8_boolean_object.cc index ec2b475..52db863 100644 --- a/src/php_v8_boolean_object.cc +++ b/src/php_v8_boolean_object.cc @@ -58,7 +58,7 @@ static PHP_METHOD(BooleanObject, valueOf) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_cached_data.cc b/src/php_v8_cached_data.cc index 0b8c0fa..cdafe69 100644 --- a/src/php_v8_cached_data.cc +++ b/src/php_v8_cached_data.cc @@ -106,7 +106,7 @@ static PHP_METHOD(CachedData, isRejected) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_context.cc b/src/php_v8_context.cc index 98cb0fe..a09b68b 100644 --- a/src/php_v8_context.cc +++ b/src/php_v8_context.cc @@ -262,7 +262,7 @@ static PHP_METHOD(Context, setErrorMessageForCodeGenerationFromStrings) context->SetErrorMessageForCodeGenerationFromStrings(local_string); } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_OBJ_INFO(0, global_template, V8\\ObjectTemplate, 1) ZEND_ARG_OBJ_INFO(0, global_object, V8\\ObjectValue, 1) @@ -275,32 +275,27 @@ ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_globalObject, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_detachGlobal, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_detachGlobal, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setSecurityToken, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setSecurityToken, 1) ZEND_ARG_OBJ_INFO(0, token, V8\\Value, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_useDefaultSecurityToken, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_useDefaultSecurityToken, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getSecurityToken, ZEND_RETURN_VALUE, 0, V8\\Value, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_allowCodeGenerationFromStrings, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_allowCodeGenerationFromStrings, 1) ZEND_ARG_TYPE_INFO(0, allow, _IS_BOOL, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_isCodeGenerationFromStringsAllowed, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setErrorMessageForCodeGenerationFromStrings, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setErrorMessageForCodeGenerationFromStrings, 1) ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_date.cc b/src/php_v8_date.cc index a98ea9f..4d105bd 100644 --- a/src/php_v8_date.cc +++ b/src/php_v8_date.cc @@ -72,7 +72,7 @@ static PHP_METHOD(Date, dateTimeConfigurationChangeNotification) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_TYPE_INFO(0, time, IS_DOUBLE, 0) ZEND_END_ARG_INFO() @@ -80,8 +80,7 @@ ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_valueOf, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_dateTimeConfigurationChangeNotification, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_dateTimeConfigurationChangeNotification, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\isolate, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_enums.cc b/src/php_v8_enums.cc index f79eb93..6b9110d 100644 --- a/src/php_v8_enums.cc +++ b/src/php_v8_enums.cc @@ -39,19 +39,21 @@ PHP_MINIT_FUNCTION (php_v8_enums) { #define this_ce php_v8_access_control_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "AccessControl", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; zend_declare_class_constant_long(this_ce, ZEND_STRL("DEFAULT_ACCESS"), v8::AccessControl::DEFAULT); - zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_READ"), v8::AccessControl::ALL_CAN_READ); - zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_WRITE"), v8::AccessControl::ALL_CAN_WRITE); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_READ"), v8::AccessControl::ALL_CAN_READ); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_WRITE"), v8::AccessControl::ALL_CAN_WRITE); #undef this_ce //v8::ConstructorBehavior #define this_ce php_v8_constructor_behavior_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "ConstructorBehavior", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("kThrow"), static_cast(v8::ConstructorBehavior::kThrow)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kAllow"), static_cast(v8::ConstructorBehavior::kAllow)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("THROW"), static_cast(v8::ConstructorBehavior::kThrow)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ALLOW"), static_cast(v8::ConstructorBehavior::kAllow)); #undef this_ce @@ -59,20 +61,22 @@ PHP_MINIT_FUNCTION (php_v8_enums) { #define this_ce php_v8_integrity_level_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "IntegrityLevel", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("kFrozen"), static_cast(v8::IntegrityLevel::kFrozen)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kSealed"), static_cast(v8::IntegrityLevel::kSealed)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("FROZEN"), static_cast(v8::IntegrityLevel::kFrozen)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("SEALED"), static_cast(v8::IntegrityLevel::kSealed)); #undef this_ce // v8::PropertyAttribute #define this_ce php_v8_property_attribute_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "PropertyAttribute", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("None"), v8::PropertyAttribute::None); - zend_declare_class_constant_long(this_ce, ZEND_STRL("ReadOnly"), v8::PropertyAttribute::ReadOnly); - zend_declare_class_constant_long(this_ce, ZEND_STRL("DontEnum"), v8::PropertyAttribute::DontEnum); - zend_declare_class_constant_long(this_ce, ZEND_STRL("DontDelete"), v8::PropertyAttribute::DontDelete); + zend_declare_class_constant_long(this_ce, ZEND_STRL("NONE"), v8::PropertyAttribute::None); + zend_declare_class_constant_long(this_ce, ZEND_STRL("READ_ONLY"), v8::PropertyAttribute::ReadOnly); + zend_declare_class_constant_long(this_ce, ZEND_STRL("DONT_ENUM"), v8::PropertyAttribute::DontEnum); + zend_declare_class_constant_long(this_ce, ZEND_STRL("DONT_DELETE"), v8::PropertyAttribute::DontDelete); #undef this_ce @@ -80,42 +84,46 @@ PHP_MINIT_FUNCTION (php_v8_enums) { #define this_ce php_v8_property_handler_flags_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "PropertyHandlerFlags", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("kNone"), static_cast(v8::PropertyHandlerFlags::kNone)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kAllCanRead"), static_cast(v8::PropertyHandlerFlags::kAllCanRead)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kNonMasking"), static_cast(v8::PropertyHandlerFlags::kNonMasking)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kOnlyInterceptStrings"), static_cast(v8::PropertyHandlerFlags::kOnlyInterceptStrings)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("NONE"), static_cast(v8::PropertyHandlerFlags::kNone)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_CAN_READ"), static_cast(v8::PropertyHandlerFlags::kAllCanRead)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("NON_MASKING"), static_cast(v8::PropertyHandlerFlags::kNonMasking)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_INTERCEPT_STRINGS"), static_cast(v8::PropertyHandlerFlags::kOnlyInterceptStrings)); #undef this_ce // v8::PropertyFilter #define this_ce php_v8_property_filter_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "PropertyFilter", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_PROPERTIES"), v8::PropertyFilter::ALL_PROPERTIES); - zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_WRITABLE"), v8::PropertyFilter::ONLY_WRITABLE); - zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_ENUMERABLE"), v8::PropertyFilter::ONLY_ENUMERABLE); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ALL_PROPERTIES"), v8::PropertyFilter::ALL_PROPERTIES); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_WRITABLE"), v8::PropertyFilter::ONLY_WRITABLE); + zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_ENUMERABLE"), v8::PropertyFilter::ONLY_ENUMERABLE); zend_declare_class_constant_long(this_ce, ZEND_STRL("ONLY_CONFIGURABLE"), v8::PropertyFilter::ONLY_CONFIGURABLE); - zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_STRINGS"), v8::PropertyFilter::SKIP_STRINGS); - zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_SYMBOLS"), v8::PropertyFilter::SKIP_SYMBOLS); + zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_STRINGS"), v8::PropertyFilter::SKIP_STRINGS); + zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_SYMBOLS"), v8::PropertyFilter::SKIP_SYMBOLS); #undef this_ce // v8::KeyCollectionMode #define this_ce php_v8_key_collection_mode_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "KeyCollectionMode", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("kOwnOnly"), static_cast(v8::KeyCollectionMode::kOwnOnly)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kIncludePrototypes"), static_cast(v8::KeyCollectionMode::kIncludePrototypes)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("OWN_ONLY"), static_cast(v8::KeyCollectionMode::kOwnOnly)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("INCLUDE_PROTOTYPES"), static_cast(v8::KeyCollectionMode::kIncludePrototypes)); #undef this_ce // v8::IndexFilter #define this_ce php_v8_index_filter_class_entry INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "IndexFilter", php_v8_enum_methods); this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("kIncludeIndices"), static_cast(v8::IndexFilter::kIncludeIndices)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kSkipIndices"), static_cast(v8::IndexFilter::kSkipIndices)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("INCLUDE_INDICES"), static_cast(v8::IndexFilter::kIncludeIndices)); + zend_declare_class_constant_long(this_ce, ZEND_STRL("SKIP_INDICES"), static_cast(v8::IndexFilter::kSkipIndices)); #undef this_ce return SUCCESS; diff --git a/src/php_v8_exception.cc b/src/php_v8_exception_manager.cc similarity index 78% rename from src/php_v8_exception.cc rename to src/php_v8_exception_manager.cc index 071d63f..bb10fcc 100644 --- a/src/php_v8_exception.cc +++ b/src/php_v8_exception_manager.cc @@ -14,7 +14,7 @@ #include "config.h" #endif -#include "php_v8_exception.h" +#include "php_v8_exception_manager.h" #include "php_v8_stack_trace.h" #include "php_v8_message.h" #include "php_v8_string.h" @@ -22,11 +22,11 @@ #include "php_v8_isolate.h" #include "php_v8.h" -zend_class_entry *php_v8_exception_class_entry; -#define this_ce php_v8_exception_class_entry +zend_class_entry *php_v8_exception_manager_class_entry; +#define this_ce php_v8_exception_manager_class_entry -static PHP_METHOD(Exception, rangeError) { +static PHP_METHOD(ExceptionManager, createRangeError) { zval *php_v8_message_zv; zval *php_v8_context_zv; @@ -49,7 +49,7 @@ static PHP_METHOD(Exception, rangeError) { php_v8_create_value(return_value, local_value, php_v8_context->php_v8_isolate); } -static PHP_METHOD(Exception, referenceError) { +static PHP_METHOD(ExceptionManager, createReferenceError) { zval *php_v8_message_zv; zval *php_v8_context_zv; @@ -72,7 +72,7 @@ static PHP_METHOD(Exception, referenceError) { php_v8_create_value(return_value, local_value, php_v8_context->php_v8_isolate); } -static PHP_METHOD(Exception, syntaxError) { +static PHP_METHOD(ExceptionManager, createSyntaxError) { zval *php_v8_message_zv; zval *php_v8_context_zv; @@ -95,7 +95,7 @@ static PHP_METHOD(Exception, syntaxError) { php_v8_create_value(return_value, local_value, php_v8_context->php_v8_isolate); } -static PHP_METHOD(Exception, typeError) { +static PHP_METHOD(ExceptionManager, createTypeError) { zval *php_v8_message_zv; zval *php_v8_context_zv; @@ -117,7 +117,7 @@ static PHP_METHOD(Exception, typeError) { php_v8_create_value(return_value, local_value, php_v8_context->php_v8_isolate); } -static PHP_METHOD(Exception, error) { +static PHP_METHOD(ExceptionManager, createError) { zval *php_v8_message_zv; zval *php_v8_context_zv; @@ -140,7 +140,7 @@ static PHP_METHOD(Exception, error) { php_v8_create_value(return_value, local_value, php_v8_context->php_v8_isolate); } -static PHP_METHOD(Exception, createMessage) { +static PHP_METHOD(ExceptionManager, createMessage) { zval *php_v8_context_zv; zval *php_v8_exception_zv; @@ -163,7 +163,7 @@ static PHP_METHOD(Exception, createMessage) { php_v8_message_create_from_message(return_value, php_v8_context->php_v8_isolate, local_message); } -static PHP_METHOD(Exception, getStackTrace) { +static PHP_METHOD(ExceptionManager, getStackTrace) { zval *php_v8_exception_zv; zval *php_v8_context_zv; @@ -191,27 +191,27 @@ static PHP_METHOD(Exception, getStackTrace) { } -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_rangeError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_createRangeError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_referenceError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_createReferenceError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_syntaxError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_createSyntaxError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_typeError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_createTypeError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_error, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_createError, ZEND_RETURN_VALUE, 2, V8\\ObjectValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, message, V8\\StringValue, 0) ZEND_END_ARG_INFO() @@ -226,22 +226,22 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getStackTrace, ZEND_RETURN ZEND_ARG_OBJ_INFO(0, exception, V8\\Value, 0) ZEND_END_ARG_INFO() -static const zend_function_entry php_v8_exception_methods[] = { - PHP_V8_ME(Exception, rangeError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_V8_ME(Exception, referenceError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_V8_ME(Exception, syntaxError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_V8_ME(Exception, typeError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_V8_ME(Exception, error, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_V8_ME(Exception, createMessage, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_V8_ME(Exception, getStackTrace, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) +static const zend_function_entry php_v8_exception_manger_methods[] = { + PHP_V8_ME(ExceptionManager, createRangeError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_V8_ME(ExceptionManager, createReferenceError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_V8_ME(ExceptionManager, createSyntaxError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_V8_ME(ExceptionManager, createTypeError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_V8_ME(ExceptionManager, createError, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_V8_ME(ExceptionManager, createMessage, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_V8_ME(ExceptionManager, getStackTrace, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; -PHP_MINIT_FUNCTION(php_v8_exception) { +PHP_MINIT_FUNCTION(php_v8_exception_manger) { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "Exception", php_v8_exception_methods); - this_ce = zend_register_internal_class_ex(&ce, php_v8_value_class_entry); + INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "ExceptionManager", php_v8_exception_manger_methods); + this_ce = zend_register_internal_class(&ce); return SUCCESS; } diff --git a/src/php_v8_exception.h b/src/php_v8_exception_manager.h similarity index 68% rename from src/php_v8_exception.h rename to src/php_v8_exception_manager.h index 5188c9a..d420fe8 100644 --- a/src/php_v8_exception.h +++ b/src/php_v8_exception_manager.h @@ -10,8 +10,8 @@ * http://opensource.org/licenses/MIT */ -#ifndef PHP_V8_EXCEPTION_H -#define PHP_V8_EXCEPTION_H +#ifndef PHP_V8_EXCEPTION_MANGER_H +#define PHP_V8_EXCEPTION_MANGER_H extern "C" { #include "php.h" @@ -21,9 +21,9 @@ extern "C" { #endif } -extern zend_class_entry* php_v8_exception_class_entry; +extern zend_class_entry* php_v8_exception_manager_class_entry; -PHP_MINIT_FUNCTION(php_v8_exception); +PHP_MINIT_FUNCTION(php_v8_exception_manger); -#endif //PHP_V8_EXCEPTION_H +#endif //PHP_V8_EXCEPTION_MANGER_H diff --git a/src/php_v8_exceptions.cc b/src/php_v8_exceptions.cc index 3503cf0..a8fe314 100644 --- a/src/php_v8_exceptions.cc +++ b/src/php_v8_exceptions.cc @@ -154,7 +154,7 @@ static PHP_METHOD(ExceptionsTryCatch, getTryCatch) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 3) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, try_catch, V8\\TryCatch, 0) diff --git a/src/php_v8_function.cc b/src/php_v8_function.cc index 680aba4..0a09f36 100644 --- a/src/php_v8_function.cc +++ b/src/php_v8_function.cc @@ -541,6 +541,27 @@ static PHP_METHOD(Function, getScriptColumnNumber) { RETURN_LONG((zend_long) column_number); } +static PHP_METHOD(Function, getScriptId) { + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); + PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); + PHP_V8_ENTER_STORED_CONTEXT(php_v8_value); + + v8::Local local_function = php_v8_value_get_local_as(php_v8_value); + + int script_id = local_function->ScriptId(); + + if (script_id == v8::Message::kNoScriptIdInfo) { + RETURN_NULL(); + } + + RETURN_LONG((zend_long) script_id); +} + static PHP_METHOD(Function, getBoundFunction) { if (zend_parse_parameters_none() == FAILURE) { return; @@ -574,7 +595,7 @@ static PHP_METHOD(Function, getScriptOrigin) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_CALLABLE_INFO(0, callback, 0) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) @@ -591,8 +612,7 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_call, ZEND_RETURN_VALUE, 2 ZEND_ARG_ARRAY_INFO(0, arguments, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setName, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setName, 1) ZEND_ARG_OBJ_INFO(0, name, V8\\StringValue, 0) ZEND_END_ARG_INFO() @@ -605,12 +625,13 @@ ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getDisplayName, ZEND_RETURN_VALUE, 0, V8\\Value, 0) ZEND_END_ARG_INFO() -// long or null -ZEND_BEGIN_ARG_INFO_EX(arginfo_getScriptLineNumber, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getScriptLineNumber, ZEND_RETURN_VALUE, 0, IS_LONG, 1) +ZEND_END_ARG_INFO() + +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getScriptColumnNumber, ZEND_RETURN_VALUE, 0, IS_LONG, 1) ZEND_END_ARG_INFO() -// long or null -ZEND_BEGIN_ARG_INFO_EX(arginfo_getScriptColumnNumber, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getScriptId, ZEND_RETURN_VALUE, 0, IS_LONG, 1) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getBoundFunction, ZEND_RETURN_VALUE, 0, V8\\Value, 0) @@ -629,6 +650,7 @@ static const zend_function_entry php_v8_object_methods[] = { PHP_V8_ME(Function, getDisplayName, ZEND_ACC_PUBLIC) PHP_V8_ME(Function, getScriptLineNumber, ZEND_ACC_PUBLIC) PHP_V8_ME(Function, getScriptColumnNumber, ZEND_ACC_PUBLIC) + PHP_V8_ME(Function, getScriptId, ZEND_ACC_PUBLIC) PHP_V8_ME(Function, getBoundFunction, ZEND_ACC_PUBLIC) PHP_V8_ME(Function, getScriptOrigin, ZEND_ACC_PUBLIC) diff --git a/src/php_v8_function_template.cc b/src/php_v8_function_template.cc index 2ebaba8..de1ee98 100644 --- a/src/php_v8_function_template.cc +++ b/src/php_v8_function_template.cc @@ -450,7 +450,7 @@ static PHP_METHOD(FunctionTemplate, getExternalAllocatedMemory) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_CALLABLE_INFO(0, callback, 1) ZEND_ARG_OBJ_INFO(0, receiver, V8\\FunctionTemplate, 1) @@ -463,13 +463,13 @@ ZEND_END_ARG_INFO() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -ZEND_BEGIN_ARG_INFO_EX(arginfo_set, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_set, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\Data, 0) ZEND_ARG_TYPE_INFO(0, attributes, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setAccessorProperty, 1) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, getter, V8\\FunctionTemplate, 0) ZEND_ARG_OBJ_INFO(0, setter, V8\\FunctionTemplate, 0) @@ -477,7 +477,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETUR ZEND_ARG_TYPE_INFO(0, settings, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setNativeDataProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setNativeDataProperty, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_CALLABLE_INFO(0, getter, 0) ZEND_ARG_CALLABLE_INFO(0, setter, 1) @@ -492,48 +492,40 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getFunction, ZEND_RETURN_V ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setCallHandler, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setCallHandler, 1) ZEND_ARG_CALLABLE_INFO(0, callback, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setLength, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setLength, 1) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_instanceTemplate, ZEND_RETURN_VALUE, 0, V8\\ObjectTemplate, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_inherit, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_inherit, 1) ZEND_ARG_OBJ_INFO(0, parent, V8\\FunctionTemplate, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_prototypeTemplate, ZEND_RETURN_VALUE, 0, V8\\ObjectTemplate, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setClassName, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setClassName, 1) ZEND_ARG_OBJ_INFO(0, name, V8\\StringValue, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setAcceptAnyReceiver, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setAcceptAnyReceiver, 1) ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setHiddenPrototype, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setHiddenPrototype, 1) ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_readOnlyPrototype, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_readOnlyPrototype, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_removePrototype, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_removePrototype, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hasInstance, ZEND_RETURN_VALUE, 1, _IS_BOOL, 0) diff --git a/src/php_v8_heap_statistics.cc b/src/php_v8_heap_statistics.cc index f4046f1..423a841 100644 --- a/src/php_v8_heap_statistics.cc +++ b/src/php_v8_heap_statistics.cc @@ -70,7 +70,7 @@ static PHP_METHOD(HeapStatistics, __construct) { zend_update_property_bool(this_ce, getThis(), ZEND_STRL("does_zap_garbage"), does_zap_garbage); } -static PHP_METHOD(HeapStatistics, total_heap_size) { +static PHP_METHOD(HeapStatistics, getTotalHeapSize) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -80,7 +80,7 @@ static PHP_METHOD(HeapStatistics, total_heap_size) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("total_heap_size"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, total_heap_size_executable) { +static PHP_METHOD(HeapStatistics, getTotalHeapSizeExecutable) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -90,7 +90,7 @@ static PHP_METHOD(HeapStatistics, total_heap_size_executable) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("total_heap_size_executable"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, total_physical_size) { +static PHP_METHOD(HeapStatistics, getTotalPhysicalSize) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -100,7 +100,7 @@ static PHP_METHOD(HeapStatistics, total_physical_size) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("total_physical_size"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, total_available_size) { +static PHP_METHOD(HeapStatistics, getTotalAvailableSize) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -110,7 +110,7 @@ static PHP_METHOD(HeapStatistics, total_available_size) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("total_available_size"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, used_heap_size) { +static PHP_METHOD(HeapStatistics, getUsedHeapSize) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -120,7 +120,7 @@ static PHP_METHOD(HeapStatistics, used_heap_size) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("used_heap_size"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, heap_size_limit) { +static PHP_METHOD(HeapStatistics, getHeapSizeLimit) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -130,7 +130,7 @@ static PHP_METHOD(HeapStatistics, heap_size_limit) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("heap_size_limit"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, malloced_memory) { +static PHP_METHOD(HeapStatistics, getMallocedMemory) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -140,7 +140,7 @@ static PHP_METHOD(HeapStatistics, malloced_memory) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("malloced_memory"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, peak_malloced_memory) { +static PHP_METHOD(HeapStatistics, getPeakMallocedMemory) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -150,7 +150,7 @@ static PHP_METHOD(HeapStatistics, peak_malloced_memory) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("peak_malloced_memory"), 0, &rv), 1, 0); } -static PHP_METHOD(HeapStatistics, does_zap_garbage) { +static PHP_METHOD(HeapStatistics, doesZapGarbage) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -161,7 +161,7 @@ static PHP_METHOD(HeapStatistics, does_zap_garbage) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 0) ZEND_ARG_TYPE_INFO(0, total_heap_size, IS_DOUBLE, 0) ZEND_ARG_TYPE_INFO(0, total_heap_size_executable, IS_DOUBLE, 0) ZEND_ARG_TYPE_INFO(0, total_physical_size, IS_DOUBLE, 0) @@ -175,46 +175,46 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, ZEND_ARG_TYPE_INFO(0, does_zap_garbage, _IS_BOOL, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_total_heap_size, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getTotalHeapSize, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_total_heap_size_executable, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getTotalHeapSizeExecutable, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_total_physical_size, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getTotalPhysicalSize, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_total_available_size, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getTotalAvailableSize, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_used_heap_size, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getUsedHeapSize, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_heap_size_limit, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getHeapSizeLimit, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_malloced_memory, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getMallocedMemory, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_peak_malloced_memory, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getPeakMallocedMemory, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_does_zap_garbage, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_doesZapGarbage, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() static const zend_function_entry php_v8_heap_statistics_methods[] = { PHP_V8_ME(HeapStatistics, __construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_V8_ME(HeapStatistics, total_heap_size, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, total_heap_size_executable, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, total_physical_size, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, total_available_size, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, used_heap_size, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, heap_size_limit, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, malloced_memory, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, peak_malloced_memory, ZEND_ACC_PUBLIC) - PHP_V8_ME(HeapStatistics, does_zap_garbage, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getTotalHeapSize, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getTotalHeapSizeExecutable, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getTotalPhysicalSize, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getTotalAvailableSize, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getUsedHeapSize, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getHeapSizeLimit, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getMallocedMemory, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, getPeakMallocedMemory, ZEND_ACC_PUBLIC) + PHP_V8_ME(HeapStatistics, doesZapGarbage, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/src/php_v8_indexed_property_handler_configuration.cc b/src/php_v8_indexed_property_handler_configuration.cc index db3a526..c97e79d 100644 --- a/src/php_v8_indexed_property_handler_configuration.cc +++ b/src/php_v8_indexed_property_handler_configuration.cc @@ -123,13 +123,13 @@ static PHP_METHOD(IndexedPropertyHandlerConfiguration, __construct) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, getter) - ZEND_ARG_INFO(0, setter) - ZEND_ARG_INFO(0, query) - ZEND_ARG_INFO(0, deleter) - ZEND_ARG_INFO(0, enumerator) - ZEND_ARG_INFO(0, flags) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) + ZEND_ARG_CALLABLE_INFO(0, getter, 0) + ZEND_ARG_CALLABLE_INFO(0, setter, 1) + ZEND_ARG_CALLABLE_INFO(0, query, 1) + ZEND_ARG_CALLABLE_INFO(0, deleter, 1) + ZEND_ARG_CALLABLE_INFO(0, enumerator, 1) + ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_int32.cc b/src/php_v8_int32.cc index a51675c..2ee1c3e 100644 --- a/src/php_v8_int32.cc +++ b/src/php_v8_int32.cc @@ -59,7 +59,7 @@ static PHP_METHOD(Int32, value) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_integer.cc b/src/php_v8_integer.cc index 29009d5..5813fcf 100644 --- a/src/php_v8_integer.cc +++ b/src/php_v8_integer.cc @@ -64,7 +64,7 @@ static PHP_METHOD(Integer, value) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_isolate.cc b/src/php_v8_isolate.cc index 22784ae..d7bc808 100644 --- a/src/php_v8_isolate.cc +++ b/src/php_v8_isolate.cc @@ -487,11 +487,11 @@ static PHP_METHOD(Isolate, isInUse) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 0) ZEND_ARG_OBJ_INFO(0, snapshot, V8\\StartupData, 1) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setTimeLimit, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setTimeLimit, 1) ZEND_ARG_TYPE_INFO(0, time_limit_in_seconds, IS_DOUBLE, 0) ZEND_END_ARG_INFO() @@ -501,7 +501,7 @@ ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_isTimeLimitHit, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setMemoryLimit, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setMemoryLimit, 1) ZEND_ARG_TYPE_INFO(0, memory_limit_in_bytes, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -520,7 +520,7 @@ ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getEnteredContext, ZEND_RETURN_VALUE, 0, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_throwException, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_throwException, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) ZEND_ARG_OBJ_INFO(0, e, Throwable, 0) @@ -530,23 +530,19 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_idleNotificationDeadline, ZEND_ARG_INFO(0, deadline_in_seconds) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_lowMemoryNotification, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_lowMemoryNotification, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_terminateExecution, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_terminateExecution, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_isExecutionTerminating, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_cancelTerminateExecution, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_cancelTerminateExecution, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setCaptureStackTraceForUncaughtExceptions, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setCaptureStackTraceForUncaughtExceptions, 1) ZEND_ARG_TYPE_INFO(0, capture, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, frame_limit, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_map.cc b/src/php_v8_map.cc index 1cad50c..7c30d51 100644 --- a/src/php_v8_map.cc +++ b/src/php_v8_map.cc @@ -225,14 +225,14 @@ static PHP_METHOD(Map, asArray) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_size, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_clear, ZEND_RETURN_VALUE, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_clear, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_get, ZEND_RETURN_VALUE, 2, V8\\Value, 0) diff --git a/src/php_v8_message.cc b/src/php_v8_message.cc index 912150c..3c95f57 100644 --- a/src/php_v8_message.cc +++ b/src/php_v8_message.cc @@ -277,7 +277,7 @@ static PHP_METHOD(Message, isOpaque) RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("is_opaque"), 0, &rv), 1, 0); } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 5) ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, source_line, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, script_origin, V8\\ScriptOrigin, 0) diff --git a/src/php_v8_named_property_handler_configuration.cc b/src/php_v8_named_property_handler_configuration.cc index bbf208d..85d9265 100644 --- a/src/php_v8_named_property_handler_configuration.cc +++ b/src/php_v8_named_property_handler_configuration.cc @@ -123,13 +123,13 @@ static PHP_METHOD(NamedPropertyHandlerConfiguration, __construct) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, getter) - ZEND_ARG_INFO(0, setter) - ZEND_ARG_INFO(0, query) - ZEND_ARG_INFO(0, deleter) - ZEND_ARG_INFO(0, enumerator) - ZEND_ARG_INFO(0, flags) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) + ZEND_ARG_CALLABLE_INFO(0, getter, 0) + ZEND_ARG_CALLABLE_INFO(0, setter, 1) + ZEND_ARG_CALLABLE_INFO(0, query, 1) + ZEND_ARG_CALLABLE_INFO(0, deleter, 1) + ZEND_ARG_CALLABLE_INFO(0, enumerator, 1) + ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_null.cc b/src/php_v8_null.cc index 7e2c4de..f77fc2a 100644 --- a/src/php_v8_null.cc +++ b/src/php_v8_null.cc @@ -43,10 +43,11 @@ static PHP_METHOD(NullValue, value) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_END_ARG_INFO() +// no strict typing as it returns NULL and null typehint doesn't work on PHP 7.1 ZEND_BEGIN_ARG_INFO_EX(arginfo_value, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_number.cc b/src/php_v8_number.cc index bc83036..d685126 100644 --- a/src/php_v8_number.cc +++ b/src/php_v8_number.cc @@ -56,7 +56,7 @@ static PHP_METHOD(Number, value) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_TYPE_INFO(0, value, IS_DOUBLE, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_number_object.cc b/src/php_v8_number_object.cc index b14d1ed..e230efd 100644 --- a/src/php_v8_number_object.cc +++ b/src/php_v8_number_object.cc @@ -58,7 +58,7 @@ static PHP_METHOD(NumberObject, valueOf) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() diff --git a/src/php_v8_object.cc b/src/php_v8_object.cc index f681d4d..79ddcb8 100644 --- a/src/php_v8_object.cc +++ b/src/php_v8_object.cc @@ -1289,14 +1289,14 @@ static PHP_METHOD(Object, getExternalAllocatedMemory) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getContext, ZEND_RETURN_VALUE, 0, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_set, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_set, 3) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, key, V8\\Value, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) @@ -1351,7 +1351,7 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_setAccessor, ZEND_RETURN_ ZEND_END_ARG_INFO() //void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setAccessorProperty, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, getter, V8\\FunctionObject, 0) ZEND_ARG_OBJ_INFO(0, setter, V8\\FunctionObject, 0) diff --git a/src/php_v8_object_template.cc b/src/php_v8_object_template.cc index ba55886..2274f8f 100644 --- a/src/php_v8_object_template.cc +++ b/src/php_v8_object_template.cc @@ -383,7 +383,7 @@ static PHP_METHOD(ObjectTemplate, getExternalAllocatedMemory) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_OBJ_INFO(0, constructor, V8\\FunctionTemplate, 1) ZEND_END_ARG_INFO() @@ -393,13 +393,13 @@ ZEND_END_ARG_INFO() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -ZEND_BEGIN_ARG_INFO_EX(arginfo_set, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_set, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\Data, 0) ZEND_ARG_TYPE_INFO(0, attributes, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setAccessorProperty, 1) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, getter, V8\\FunctionTemplate, 0) ZEND_ARG_OBJ_INFO(0, setter, V8\\FunctionTemplate, 0) @@ -407,8 +407,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETUR ZEND_ARG_TYPE_INFO(0, settings, IS_LONG, 0) ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_setNativeDataProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setNativeDataProperty, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_CALLABLE_INFO(0, getter, 0) ZEND_ARG_CALLABLE_INFO(0, setter, 1) @@ -423,8 +422,7 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_newInstance, ZEND_RETURN_V ZEND_ARG_OBJ_INFO(0, value, V8\\Context, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessor, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setAccessor, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_CALLABLE_INFO(0, getter, 0) ZEND_ARG_CALLABLE_INFO(0, setter, 1) @@ -433,18 +431,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessor, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, ZEND_ARG_OBJ_INFO(0, receiver, V8\\FunctionTemplate, 1) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setHandlerForNamedProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setHandlerForNamedProperty, 1) ZEND_ARG_OBJ_INFO(0, configuration, V8\\NamedPropertyHandlerConfiguration, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setHandlerForIndexedProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setHandlerForIndexedProperty, 1) ZEND_ARG_OBJ_INFO(0, configuration, V8\\IndexedPropertyHandlerConfiguration, 0) ZEND_END_ARG_INFO() -// void method -ZEND_BEGIN_ARG_INFO_EX(arginfo_setCallAsFunctionHandler, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setCallAsFunctionHandler, 1) ZEND_ARG_INFO(0, callback) ZEND_END_ARG_INFO() diff --git a/src/php_v8_regexp.cc b/src/php_v8_regexp.cc index 5d23a6a..0d48f9e 100644 --- a/src/php_v8_regexp.cc +++ b/src/php_v8_regexp.cc @@ -82,7 +82,7 @@ static PHP_METHOD(RegExp, getFlags) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\StringValue, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 1) @@ -112,16 +112,19 @@ PHP_MINIT_FUNCTION(php_v8_regexp) { INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "RegExpObject", php_v8_regexp_methods); this_ce = zend_register_internal_class_ex(&ce, php_v8_object_class_entry); + #undef this_ce + #define this_ce php_v8_regexp_flags_class_entry INIT_NS_CLASS_ENTRY(ce, "V8\\RegExpObject", "Flags", php_v8_regexp_flags_methods); - php_v8_regexp_flags_class_entry = zend_register_internal_class(&ce); - - zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kNone"), v8::RegExp::Flags::kNone); - zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kGlobal"), v8::RegExp::Flags::kGlobal); - zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kIgnoreCase"), v8::RegExp::Flags::kIgnoreCase); - zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kMultiline"), v8::RegExp::Flags::kMultiline); - zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kSticky"), v8::RegExp::Flags::kSticky); - zend_declare_class_constant_long(php_v8_regexp_flags_class_entry, ZEND_STRL("kUnicode"), v8::RegExp::Flags::kUnicode); + this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; + + zend_declare_class_constant_long(this_ce, ZEND_STRL("NONE"), v8::RegExp::Flags::kNone); + zend_declare_class_constant_long(this_ce, ZEND_STRL("GLOBAL"), v8::RegExp::Flags::kGlobal); + zend_declare_class_constant_long(this_ce, ZEND_STRL("IGNORE_CASE"), v8::RegExp::Flags::kIgnoreCase); + zend_declare_class_constant_long(this_ce, ZEND_STRL("MULTILINE"), v8::RegExp::Flags::kMultiline); + zend_declare_class_constant_long(this_ce, ZEND_STRL("STICKY"), v8::RegExp::Flags::kSticky); + zend_declare_class_constant_long(this_ce, ZEND_STRL("UNICODE"), v8::RegExp::Flags::kUnicode); return SUCCESS; } diff --git a/src/php_v8_return_value.cc b/src/php_v8_return_value.cc index 3a3ebd1..356b1b1 100644 --- a/src/php_v8_return_value.cc +++ b/src/php_v8_return_value.cc @@ -358,29 +358,29 @@ static PHP_METHOD(ReturnValue, inContext) { PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_get, ZEND_RETURN_VALUE, 0, V8\\Value, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_set, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_set, 1) ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setNull, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setNull, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setUndefined, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setUndefined, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setEmptyString, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setEmptyString, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setBool, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setBool, 1) ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setInteger, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setInteger, 1) ZEND_ARG_TYPE_INFO(0, i, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setFloat, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setFloat, 1) ZEND_ARG_TYPE_INFO(0, i, IS_DOUBLE, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_script.cc b/src/php_v8_script.cc index b0b5722..71557af 100644 --- a/src/php_v8_script.cc +++ b/src/php_v8_script.cc @@ -203,7 +203,7 @@ static PHP_METHOD(Script, getUnboundScript) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, source, V8\\StringValue, 0) ZEND_ARG_OBJ_INFO(0, origin, V8\\ScriptOrigin, 0) diff --git a/src/php_v8_script.h b/src/php_v8_script.h index 0129a10..4ab51ea 100644 --- a/src/php_v8_script.h +++ b/src/php_v8_script.h @@ -15,7 +15,7 @@ typedef struct _php_v8_script_t php_v8_script_t; -#include "php_v8_exception.h" +#include "php_v8_exception_manager.h" #include "php_v8_context.h" #include "php_v8_isolate.h" #include diff --git a/src/php_v8_script_compiler.cc b/src/php_v8_script_compiler.cc index 7b83e10..ff77218 100644 --- a/src/php_v8_script_compiler.cc +++ b/src/php_v8_script_compiler.cc @@ -301,13 +301,14 @@ PHP_MINIT_FUNCTION(php_v8_script_compiler) #define this_ce php_v8_compile_options_class_entry INIT_NS_CLASS_ENTRY(ce, "V8\\ScriptCompiler", "CompileOptions", php_v8_compile_options_methods); - php_v8_compile_options_class_entry = zend_register_internal_class(&ce); + this_ce = zend_register_internal_class(&ce); + this_ce->ce_flags |= ZEND_ACC_FINAL; - zend_declare_class_constant_long(this_ce, ZEND_STRL("kNoCompileOptions"), v8::ScriptCompiler::CompileOptions::kNoCompileOptions); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kProduceParserCache"), v8::ScriptCompiler::CompileOptions::kProduceParserCache); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kConsumeParserCache"), v8::ScriptCompiler::CompileOptions::kConsumeParserCache); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kProduceCodeCache"), v8::ScriptCompiler::CompileOptions::kProduceCodeCache); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kConsumeCodeCache"), v8::ScriptCompiler::CompileOptions::kConsumeCodeCache); + zend_declare_class_constant_long(this_ce, ZEND_STRL("NO_COMPILE_OPTIONS"), v8::ScriptCompiler::CompileOptions::kNoCompileOptions); + zend_declare_class_constant_long(this_ce, ZEND_STRL("PRODUCE_PARSER_CACHE"), v8::ScriptCompiler::CompileOptions::kProduceParserCache); + zend_declare_class_constant_long(this_ce, ZEND_STRL("CONSUME_PARSER_CACHE"), v8::ScriptCompiler::CompileOptions::kConsumeParserCache); + zend_declare_class_constant_long(this_ce, ZEND_STRL("PRODUCE_CODE_CACHE"), v8::ScriptCompiler::CompileOptions::kProduceCodeCache); + zend_declare_class_constant_long(this_ce, ZEND_STRL("CONSUME_CODE_CACHE"), v8::ScriptCompiler::CompileOptions::kConsumeCodeCache); return SUCCESS; } diff --git a/src/php_v8_script_origin.cc b/src/php_v8_script_origin.cc index aa9aec0..dcee26a 100644 --- a/src/php_v8_script_origin.cc +++ b/src/php_v8_script_origin.cc @@ -224,7 +224,7 @@ static PHP_METHOD(ScriptOrigin, resourceColumnOffset) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("resource_column_offset"), 0, &rv), 1, 0); } -static PHP_METHOD(ScriptOrigin, scriptID) { +static PHP_METHOD(ScriptOrigin, scriptId) { zval rv; if (zend_parse_parameters_none() == FAILURE) { @@ -255,7 +255,7 @@ static PHP_METHOD(ScriptOrigin, options) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_TYPE_INFO(0, resource_name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, resource_line_offset, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, resource_column_offset, IS_LONG, 0) @@ -274,7 +274,7 @@ ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourceColumnOffset, ZEND_RETURN_VALUE, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_scriptID, ZEND_RETURN_VALUE, 0, IS_LONG, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_scriptId, ZEND_RETURN_VALUE, 0, IS_LONG, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sourceMapUrl, ZEND_RETURN_VALUE, 0, IS_STRING, 0) @@ -289,7 +289,7 @@ static const zend_function_entry php_v8_script_origin_methods[] = { PHP_V8_ME(ScriptOrigin, resourceName, ZEND_ACC_PUBLIC) PHP_V8_ME(ScriptOrigin, resourceLineOffset, ZEND_ACC_PUBLIC) PHP_V8_ME(ScriptOrigin, resourceColumnOffset, ZEND_ACC_PUBLIC) - PHP_V8_ME(ScriptOrigin, scriptID, ZEND_ACC_PUBLIC) + PHP_V8_ME(ScriptOrigin, scriptId, ZEND_ACC_PUBLIC) PHP_V8_ME(ScriptOrigin, sourceMapUrl, ZEND_ACC_PUBLIC) PHP_V8_ME(ScriptOrigin, options, ZEND_ACC_PUBLIC) diff --git a/src/php_v8_script_origin_options.cc b/src/php_v8_script_origin_options.cc index 2cc462d..d81e1ac 100644 --- a/src/php_v8_script_origin_options.cc +++ b/src/php_v8_script_origin_options.cc @@ -88,7 +88,7 @@ static PHP_METHOD(ScriptOriginOptions, isModule) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 0) ZEND_ARG_TYPE_INFO(0, is_shared_cross_origin, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, is_opaque, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, is_wasm, _IS_BOOL, 0) diff --git a/src/php_v8_set.cc b/src/php_v8_set.cc index 5e7111c..f2b3b3f 100644 --- a/src/php_v8_set.cc +++ b/src/php_v8_set.cc @@ -184,14 +184,14 @@ static PHP_METHOD(Set, asArray) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_size, ZEND_RETURN_VALUE, 0, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_clear, ZEND_RETURN_VALUE, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_clear, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_add, ZEND_RETURN_VALUE, 3, V8\\SetObject, 0) diff --git a/src/php_v8_source.cc b/src/php_v8_source.cc index 5ee35de..549bf23 100644 --- a/src/php_v8_source.cc +++ b/src/php_v8_source.cc @@ -99,7 +99,7 @@ static PHP_METHOD(Source, getCachedData) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, source_string, V8\\StringValue, 0) ZEND_ARG_OBJ_INFO(0, origin, V8\\ScriptOrigin, 1) ZEND_ARG_OBJ_INFO(0, cached_data, V8\\ScriptCompiler\\CachedData, 1) diff --git a/src/php_v8_source.h b/src/php_v8_source.h index f968ded..f4dc95f 100644 --- a/src/php_v8_source.h +++ b/src/php_v8_source.h @@ -14,7 +14,7 @@ #define PHP_V8_SOURCE_H -#include "php_v8_exception.h" +#include "php_v8_exception_manager.h" #include "php_v8_context.h" #include "php_v8_isolate.h" #include diff --git a/src/php_v8_stack_frame.cc b/src/php_v8_stack_frame.cc index 6ee5e1b..51edeea 100644 --- a/src/php_v8_stack_frame.cc +++ b/src/php_v8_stack_frame.cc @@ -187,7 +187,7 @@ static PHP_METHOD(StackFrame, isConstructor) { RETVAL_ZVAL(zend_read_property(this_ce, getThis(), ZEND_STRL("is_constructor"), 0, &rv), 1, 0); } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 0) ZEND_ARG_TYPE_INFO(0, line_number, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, column, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, script_id, IS_LONG, 0) diff --git a/src/php_v8_stack_trace.cc b/src/php_v8_stack_trace.cc index b029181..cdbf59b 100644 --- a/src/php_v8_stack_trace.cc +++ b/src/php_v8_stack_trace.cc @@ -142,7 +142,7 @@ static PHP_METHOD(StackTrace, currentStackTrace) php_v8_stack_trace_create_from_stack_trace(return_value, php_v8_isolate, trace); } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_TYPE_INFO(0, frames, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_startup_data.cc b/src/php_v8_startup_data.cc index 3e2c99a..ca08707 100644 --- a/src/php_v8_startup_data.cc +++ b/src/php_v8_startup_data.cc @@ -141,7 +141,7 @@ static PHP_METHOD(StartupData, createFromSource) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_TYPE_INFO(0, blob, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_string.cc b/src/php_v8_string.cc index 4f3a852..0e8b044 100644 --- a/src/php_v8_string.cc +++ b/src/php_v8_string.cc @@ -127,7 +127,7 @@ static PHP_METHOD(String, containsOnlyOneByte) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_INFO(0, data) ZEND_END_ARG_INFO() @@ -166,7 +166,7 @@ PHP_MINIT_FUNCTION(php_v8_string) INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "StringValue", php_v8_string_methods); this_ce = zend_register_internal_class_ex(&ce, php_v8_name_class_entry); - zend_declare_class_constant_long(this_ce, ZEND_STRL("kMaxLength"), v8::String::kMaxLength); + zend_declare_class_constant_long(this_ce, ZEND_STRL("MAX_LENGTH"), v8::String::kMaxLength); return SUCCESS; } diff --git a/src/php_v8_string_object.cc b/src/php_v8_string_object.cc index e8f24ef..2d75d84 100644 --- a/src/php_v8_string_object.cc +++ b/src/php_v8_string_object.cc @@ -62,12 +62,12 @@ static PHP_METHOD(StringObject, valueOf) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\StringValue, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_valueOf, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_valueOf, ZEND_RETURN_VALUE, 0, V8\\StringValue, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_symbol.cc b/src/php_v8_symbol.cc index 2ed250e..b8e1831 100644 --- a/src/php_v8_symbol.cc +++ b/src/php_v8_symbol.cc @@ -172,7 +172,7 @@ static PHP_V8_SYMBOL_WELL_KNOWN_METHOD(Symbol, ToStringTag); static PHP_V8_SYMBOL_WELL_KNOWN_METHOD(Symbol, Unscopables); -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_OBJ_INFO(0, name, V8\\StringValue, 1) ZEND_END_ARG_INFO() diff --git a/src/php_v8_symbol_object.cc b/src/php_v8_symbol_object.cc index 95e6a13..1378fee 100644 --- a/src/php_v8_symbol_object.cc +++ b/src/php_v8_symbol_object.cc @@ -63,7 +63,7 @@ static PHP_METHOD(SymbolObject, valueOf) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\SymbolValue, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_template.cc b/src/php_v8_template.cc index 04a415b..b2667f0 100644 --- a/src/php_v8_template.cc +++ b/src/php_v8_template.cc @@ -294,13 +294,13 @@ void php_v8_template_SetNativeDataProperty(v8::Isolate *isolate, v8::Local lo PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIsolate, ZEND_RETURN_VALUE, 0, V8\\Isolate, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_set, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_set, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, value, V8\\Data, 0) ZEND_ARG_TYPE_INFO(0, attributes, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setAccessorProperty, 1) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_OBJ_INFO(0, getter, V8\\FunctionTemplate, 0) ZEND_ARG_OBJ_INFO(0, setter, V8\\FunctionTemplate, 0) @@ -308,7 +308,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setAccessorProperty, ZEND_SEND_BY_VAL, ZEND_RETUR ZEND_ARG_TYPE_INFO(0, settings, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_setNativeDataProperty, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_setNativeDataProperty, 2) ZEND_ARG_OBJ_INFO(0, name, V8\\NameValue, 0) ZEND_ARG_CALLABLE_INFO(0, getter, 0) ZEND_ARG_CALLABLE_INFO(0, setter, 1) diff --git a/src/php_v8_try_catch.cc b/src/php_v8_try_catch.cc index 3fb2780..4467fb2 100644 --- a/src/php_v8_try_catch.cc +++ b/src/php_v8_try_catch.cc @@ -228,7 +228,7 @@ static PHP_METHOD(TryCatch, getExternalException) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, exception, V8\\Value, 1) diff --git a/src/php_v8_uint32.cc b/src/php_v8_uint32.cc index c0ff0c0..05fedfe 100644 --- a/src/php_v8_uint32.cc +++ b/src/php_v8_uint32.cc @@ -58,7 +58,7 @@ static PHP_METHOD(Uint32, value) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_unbound_script.cc b/src/php_v8_unbound_script.cc index f6fb99a..8023fd8 100644 --- a/src/php_v8_unbound_script.cc +++ b/src/php_v8_unbound_script.cc @@ -194,7 +194,7 @@ static PHP_METHOD(UnboundScript, getLineNumber) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getIsolate, ZEND_RETURN_VALUE, 0, V8\\Isolate, 0) diff --git a/src/php_v8_unbound_script.h b/src/php_v8_unbound_script.h index d232a22..a3f14bb 100644 --- a/src/php_v8_unbound_script.h +++ b/src/php_v8_unbound_script.h @@ -15,7 +15,7 @@ typedef struct _php_v8_unbound_script_t php_v8_unbound_script_t; -#include "php_v8_exception.h" +#include "php_v8_exception_manager.h" #include "php_v8_isolate.h" #include diff --git a/src/php_v8_undefined.cc b/src/php_v8_undefined.cc index cf9a81f..a9c066a 100644 --- a/src/php_v8_undefined.cc +++ b/src/php_v8_undefined.cc @@ -46,11 +46,12 @@ static PHP_METHOD(Undefined, value) } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_value, ZEND_RETURN_VALUE, 0, IS_NULL, 0) +// no strict typing as it returns NULL and null typehint doesn't work on PHP 7.1 +ZEND_BEGIN_ARG_INFO_EX(arginfo_value, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() diff --git a/src/php_v8_value.cc b/src/php_v8_value.cc index 2052005..752a85e 100644 --- a/src/php_v8_value.cc +++ b/src/php_v8_value.cc @@ -108,7 +108,7 @@ static void php_v8_value_free(zend_object *object) { php_v8_value_t *php_v8_value = php_v8_value_fetch_object(object); // TODO: check whether we have valid isolate? - if (php_v8_value->php_v8_isolate && php_v8_value->persistent && !php_v8_value->persistent->IsEmpty()) { + if (PHP_V8_IS_UP_AND_RUNNING() && php_v8_value->php_v8_isolate && php_v8_value->persistent && !php_v8_value->persistent->IsEmpty()) { PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); // TODO: in general, this makes sense only for objects @@ -923,7 +923,7 @@ static PHP_METHOD(Value, instanceOf) { } -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, isolate, V8\\Isolate, 0) ZEND_END_ARG_INFO() @@ -985,61 +985,60 @@ PHP_V8_VALUE_IS_METHOD_ARG_INFO(SharedArrayBuffer) PHP_V8_VALUE_IS_METHOD_ARG_INFO(Proxy) //PHP_V8_VALUE_IS_METHOD_ARG_INFO(WebAssemblyCompiledModule) // Experimental - -ZEND_BEGIN_ARG_INFO_EX(arginfo_toBoolean, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toBoolean, ZEND_RETURN_VALUE, 1, V8\\BooleanValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toNumber, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toNumber, ZEND_RETURN_VALUE, 1, V8\\NumberValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toString, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toString, ZEND_RETURN_VALUE, 1, V8\\StringValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toDetailString, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toDetailString, ZEND_RETURN_VALUE, 1, V8\\StringValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toObject, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toObject, ZEND_RETURN_VALUE, 1, V8\\ObjectValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toInteger, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toInteger, ZEND_RETURN_VALUE, 1, V8\\IntegerValue, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toUint32, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toUint32, ZEND_RETURN_VALUE, 1, V8\\Uint32Value, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toInt32, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toInt32, ZEND_RETURN_VALUE, 1, V8\\Int32Value, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_toArrayIndex, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_toArrayIndex, ZEND_RETURN_VALUE, 1, V8\\Uint32Value, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_booleanValue, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_booleanValue, ZEND_RETURN_VALUE, 1, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_numberValue, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_numberValue, ZEND_RETURN_VALUE, 1, IS_DOUBLE, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_integerValue, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_integerValue, ZEND_RETURN_VALUE, 1, IS_DOUBLE, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_int32Value, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_int32Value, ZEND_RETURN_VALUE, 1, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_uint32Value, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_uint32Value, ZEND_RETURN_VALUE, 1, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() diff --git a/stubs/src/AccessControl.php b/stubs/src/AccessControl.php index 08c18aa..0fe9009 100644 --- a/stubs/src/AccessControl.php +++ b/stubs/src/AccessControl.php @@ -20,5 +20,4 @@ class AccessControl const DEFAULT_ACCESS = 0; // do not allow cross-context access const ALL_CAN_READ = 1; // all cross-context reads are allowed const ALL_CAN_WRITE = 2; // all cross-context writes are allowed - // ALL_CAN_READ | ALL_CAN_WRITE could be use allow all cross-context access } diff --git a/stubs/src/ConstructorBehavior.php b/stubs/src/ConstructorBehavior.php index 1914410..b637108 100644 --- a/stubs/src/ConstructorBehavior.php +++ b/stubs/src/ConstructorBehavior.php @@ -18,6 +18,6 @@ class ConstructorBehavior { - const kThrow = 0; - const kAllow = 1; + const THROW = 0; + const ALLOW = 1; } diff --git a/stubs/src/Exception.php b/stubs/src/ExceptionManager.php similarity index 77% rename from stubs/src/Exception.php rename to stubs/src/ExceptionManager.php index 6c27e9c..0c0c3c0 100644 --- a/stubs/src/Exception.php +++ b/stubs/src/ExceptionManager.php @@ -20,7 +20,7 @@ * Create new error objects by calling the corresponding error object * constructor with the message. */ -class Exception +class ExceptionManager { /** * @param Context $context @@ -28,7 +28,7 @@ class Exception * * @return \V8\ObjectValue */ - public static function rangeError(Context $context, StringValue $message): ObjectValue + public static function createRangeError(Context $context, StringValue $message): ObjectValue { } @@ -38,7 +38,7 @@ public static function rangeError(Context $context, StringValue $message): Objec * * @return \V8\ObjectValue */ - public static function referenceError(Context $context, StringValue $message): ObjectValue + public static function createReferenceError(Context $context, StringValue $message): ObjectValue { } @@ -48,7 +48,7 @@ public static function referenceError(Context $context, StringValue $message): O * * @return \V8\ObjectValue */ - public static function syntaxError(Context $context, StringValue $message): ObjectValue + public static function createSyntaxError(Context $context, StringValue $message): ObjectValue { } @@ -58,7 +58,7 @@ public static function syntaxError(Context $context, StringValue $message): Obje * * @return \V8\ObjectValue */ - public static function typeError(Context $context, StringValue $message): ObjectValue + public static function createTypeError(Context $context, StringValue $message): ObjectValue { } @@ -68,7 +68,7 @@ public static function typeError(Context $context, StringValue $message): Object * * @return ObjectValue */ - public static function error(Context $context, StringValue $message): ObjectValue + public static function createError(Context $context, StringValue $message): ObjectValue { } @@ -82,7 +82,7 @@ public static function error(Context $context, StringValue $message): ObjectValu * * @return Message */ - static function createMessage(Context $context, Value $exception): Message + public static function createMessage(Context $context, Value $exception): Message { } diff --git a/stubs/src/FunctionObject.php b/stubs/src/FunctionObject.php index 3444809..f051495 100644 --- a/stubs/src/FunctionObject.php +++ b/stubs/src/FunctionObject.php @@ -30,7 +30,7 @@ class FunctionObject extends ObjectValue * @param int $length * @param int $behavior */ - public function __construct(Context $context, callable $callback, int $length = 0, int $behavior = ConstructorBehavior::kAllow) + public function __construct(Context $context, callable $callback, int $length = 0, int $behavior = ConstructorBehavior::ALLOW) { parent::__construct($context); } @@ -94,38 +94,38 @@ public function getDisplayName(): Value /** * Returns zero based line number of function body and - * kLineOffsetNotFound if no information available. + * null if no information available. * - * NOTE: null used instead of kLineOffsetNotFound - * - * @return int | null + * @return int|null */ - public function getScriptLineNumber() + public function getScriptLineNumber(): ?int { } /** * Returns zero based column number of function body and - * kLineOffsetNotFound if no information available. - * NOTE: null used instead of kLineOffsetNotFound + * null if no information available. * - * @return int | null + * @return int|null */ - public function getScriptColumnNumber() + public function getScriptColumnNumber(): ?int { } - ///** - // * Returns scriptId. - // */ - //int ScriptId() const; + /** + * Returns script id where function was created and null if no information available. + * + * @return int + */ + public function getScriptId(): ?int + { + } /** - * Returns the original function if this function is bound, else returns - * v8::Undefined. + * Returns the original function if this function is bound, else returns UndefinedValue. * - * @return Value + * @return FunctionObject|UndefinedValue|Value */ public function getBoundFunction(): Value { diff --git a/stubs/src/FunctionTemplate.php b/stubs/src/FunctionTemplate.php index 39983ad..3eca7b1 100644 --- a/stubs/src/FunctionTemplate.php +++ b/stubs/src/FunctionTemplate.php @@ -129,7 +129,7 @@ public function __construct( callable $callback = null, FunctionTemplate $receiver = null, int $length = 0, - int $behavior = ConstructorBehavior::kAllow + int $behavior = ConstructorBehavior::ALLOW ) { parent::__construct($isolate); } @@ -151,13 +151,21 @@ public function getFunction(Context $context): FunctionObject * FunctionTemplate is called. * * @param callable $callback + * + * @return void */ - public function setCallHandler(callable $callback) + public function setCallHandler(callable $callback): void { } - /** Set the predefined length property for the FunctionTemplate. */ - public function setLength(int $length) + /** + * Set the predefined length property for the FunctionTemplate. + * + * @param int $length + * + * @return void + */ + public function setLength(int $length): void { } @@ -174,6 +182,8 @@ public function instanceTemplate(): ObjectTemplate * Causes the function template to inherit from a parent function template. * * @param FunctionTemplate $parent + * + * @return void */ public function inherit(FunctionTemplate $parent) { @@ -195,8 +205,10 @@ public function prototypeTemplate(): ObjectTemplate * FunctionTemplate as its constructor. * * @param StringValue $name + * + * @return void */ - public function setClassName(StringValue $name) + public function setClassName(StringValue $name): void { } @@ -218,24 +230,32 @@ public function setClassName(StringValue $name) * to make the __proto__ accessor not ignore instances of the * function template. By default, instances of a function template * are not ignored. + * + * @param bool $value + * + * @return void */ - public function setHiddenPrototype($value) + public function setHiddenPrototype(bool $value): void { } /** * Sets the ReadOnly flag in the attributes of the 'prototype' property * of functions created from this FunctionTemplate to true. + * + * @return void */ - public function readOnlyPrototype() + public function readOnlyPrototype(): void { } /** * Removes the prototype property from functions created from this * FunctionTemplate. + * + * @return void */ - public function removePrototype() + public function removePrototype(): void { } diff --git a/stubs/src/HeapStatistics.php b/stubs/src/HeapStatistics.php index 7dd3abb..cbc5cf7 100644 --- a/stubs/src/HeapStatistics.php +++ b/stubs/src/HeapStatistics.php @@ -93,47 +93,76 @@ public function __construct( $this->does_zap_garbage = $does_zap_garbage; } - public function total_heap_size(): float + /** + * @return float + */ + public function getTotalHeapSize(): float { return $this->total_heap_size; } - public function total_heap_size_executable(): float + /** + * @return float + */ + public function getTotalHeapSizeExecutable(): float { return $this->total_heap_size_executable; } - public function total_physical_size(): float + /** + * @return float + */ + public function getTotalPhysicalSize(): float { return $this->total_physical_size; } - public function total_available_size(): float + /** + * @return float + */ + public function getTotalAvailableSize(): float { return $this->total_available_size; } - public function used_heap_size(): float + /** + * @return float + */ + public function getUsedHeapSize(): float { return $this->used_heap_size; } - public function heap_size_limit(): float + /** + * @return float + */ + public function getHeapSizeLimit(): float { return $this->heap_size_limit; } - public function malloced_memory(): float + /** + * @return float + */ + public function getMallocedMemory(): float { return $this->malloced_memory; } - public function peak_malloced_memory(): float + /** + * @return float + */ + public function getPeakMallocedMemory(): float { return $this->peak_malloced_memory; } - public function does_zap_garbage(): bool + /** + * Returns a boolean, which signifies whether the V8 overwrite heap garbage with a bit pattern. + * + * @return bool + */ + public function doesZapGarbage(): bool { return $this->does_zap_garbage; } diff --git a/stubs/src/IndexedPropertyHandlerConfiguration.php b/stubs/src/IndexedPropertyHandlerConfiguration.php index 37bf03a..06a6650 100644 --- a/stubs/src/IndexedPropertyHandlerConfiguration.php +++ b/stubs/src/IndexedPropertyHandlerConfiguration.php @@ -24,7 +24,7 @@ class IndexedPropertyHandlerConfiguration * @param callable $query The callback to invoke to check if an object has a property. * @param callable $deleter The callback to invoke when deleting a property. * @param callable $enumerator The callback to invoke to enumerate all the indexed properties of an object. - * @param int $flags One of \v8\PropertyHandlerFlags constants + * @param int $flags One of \V8\PropertyHandlerFlags constants */ public function __construct( callable $getter, @@ -32,7 +32,7 @@ public function __construct( callable $query = null, callable $deleter = null, callable $enumerator = null, - $flags = PropertyHandlerFlags::kNone + $flags = PropertyHandlerFlags::NONE ) { } } diff --git a/stubs/src/IntegrityLevel.php b/stubs/src/IntegrityLevel.php index 5d78c08..240f666 100644 --- a/stubs/src/IntegrityLevel.php +++ b/stubs/src/IntegrityLevel.php @@ -20,6 +20,6 @@ */ class IntegrityLevel { - const kFrozen = 0; - const kSealed = 1; + const FROZEN = 0; + const SEALED = 1; } diff --git a/stubs/src/NamedPropertyHandlerConfiguration.php b/stubs/src/NamedPropertyHandlerConfiguration.php index 04d7168..480c8c5 100644 --- a/stubs/src/NamedPropertyHandlerConfiguration.php +++ b/stubs/src/NamedPropertyHandlerConfiguration.php @@ -39,7 +39,7 @@ class NamedPropertyHandlerConfiguration * Callback signature is (PropertyCallbackInfo $args). * ReturnValue from $args->GetReturnValue() accepts ArrayObject only * - * @param int $flags One of \v8\PropertyHandlerFlags constants + * @param int $flags One of \V8\PropertyHandlerFlags constants */ public function __construct( callable $getter, @@ -47,7 +47,7 @@ public function __construct( callable $query = null, callable $deleter = null, callable $enumerator = null, - $flags = PropertyHandlerFlags::kNone + $flags = PropertyHandlerFlags::NONE ) { } } diff --git a/stubs/src/ObjectTemplate.php b/stubs/src/ObjectTemplate.php index 1da6ae5..1be45c8 100644 --- a/stubs/src/ObjectTemplate.php +++ b/stubs/src/ObjectTemplate.php @@ -72,7 +72,7 @@ public function setAccessor( callable $getter, callable $setter, $settings = AccessControl::DEFAULT_ACCESS, - $attributes = PropertyAttribute::None, + $attributes = PropertyAttribute::NONE, FunctionTemplate $receiver ) { } @@ -85,9 +85,9 @@ public function setAccessor( * invoked instead of accessing the property directly on the JavaScript * object. * - * See \v8\NamedPropertyHandlerConfiguration constructor argument description for details + * See \V8\NamedPropertyHandlerConfiguration constructor argument description for details * - * @param \v8\NamedPropertyHandlerConfiguration The NamedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property. + * @param \V8\NamedPropertyHandlerConfiguration The NamedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property. */ public function setHandlerForNamedProperty(NamedPropertyHandlerConfiguration $configuration) { @@ -100,7 +100,7 @@ public function setHandlerForNamedProperty(NamedPropertyHandlerConfiguration $co * this object template, the provided callback is invoked instead of * accessing the property directly on the JavaScript object. * - * See \v8\IndexedPropertyHandlerConfiguration constructor argument description for details + * See \V8\IndexedPropertyHandlerConfiguration constructor argument description for details * * @param \V8\IndexedPropertyHandlerConfiguration $configuration The IndexedPropertyHandlerConfiguration that defines the callbacks to invoke when accessing a property. */ diff --git a/stubs/src/ObjectValue.php b/stubs/src/ObjectValue.php index d88f46b..6fbf1fb 100644 --- a/stubs/src/ObjectValue.php +++ b/stubs/src/ObjectValue.php @@ -78,7 +78,7 @@ public function defineOwnProperty( Context $context, NameValue $key, Value $value, - int $attributes = PropertyAttribute::None + int $attributes = PropertyAttribute::NONE ): bool { } @@ -154,7 +154,7 @@ public function setAccessor( callable $getter, callable $setter = null, int $settings = AccessControl::DEFAULT_ACCESS, - int $attributes = PropertyAttribute::None + int $attributes = PropertyAttribute::NONE ): bool { } @@ -169,7 +169,7 @@ public function setAccessorProperty( NameValue $name, FunctionObject $getter, FunctionObject $setter = null, - int $attributes = PropertyAttribute::None, + int $attributes = PropertyAttribute::NONE, int $settings = AccessControl::DEFAULT_ACCESS ) { } @@ -191,7 +191,7 @@ public function setNativeDataProperty( NameValue $name, callable $getter, callable $setter = null, - int $attributes = PropertyAttribute::None + int $attributes = PropertyAttribute::NONE ): bool { } diff --git a/stubs/src/PropertyAttribute.php b/stubs/src/PropertyAttribute.php index dfab3c3..df50c79 100644 --- a/stubs/src/PropertyAttribute.php +++ b/stubs/src/PropertyAttribute.php @@ -18,8 +18,8 @@ class PropertyAttribute { - const None = 0; - const ReadOnly = 1; - const DontEnum = 2; - const DontDelete = 4; + const NONE = 0; + const READ_ONLY = 1; + const DONT_ENUM = 2; + const DONT_DELETE = 4; } diff --git a/stubs/src/PropertyFilter.php b/stubs/src/PropertyFilter.php index f17b0ff..24d98c9 100644 --- a/stubs/src/PropertyFilter.php +++ b/stubs/src/PropertyFilter.php @@ -20,10 +20,10 @@ */ class PropertyFilter { - const ALL_PROPERTIES = 0; - const ONLY_WRITABLE = 1; - const ONLY_ENUMERABLE = 2; + const ALL_PROPERTIES = 0; + const ONLY_WRITABLE = 1; + const ONLY_ENUMERABLE = 2; const ONLY_CONFIGURABLE = 4; - const SKIP_STRINGS = 8; - const SKIP_SYMBOLS = 16; + const SKIP_STRINGS = 8; + const SKIP_SYMBOLS = 16; } diff --git a/stubs/src/PropertyHandlerFlags.php b/stubs/src/PropertyHandlerFlags.php index 4ab0f83..a1f4359 100644 --- a/stubs/src/PropertyHandlerFlags.php +++ b/stubs/src/PropertyHandlerFlags.php @@ -25,19 +25,19 @@ class PropertyHandlerFlags /** * None. */ - const kNone = 0; + const NONE = 0; /** * See \V8\AccessControl::ALL_CAN_READ (all cross-context reads are allowed). */ - const kAllCanRead = 1; + const ALL_CAN_READ = 1; /** Will not call into interceptor for properties on the receiver or prototype * chain, i.e., only call into interceptor for properties that do not exist. * Currently only valid for named interceptors. */ - const kNonMasking = 2; + const NON_MASKING = 2; /** * Will not call into interceptor for symbol lookup. Only meaningful for * named interceptors. */ - const kOnlyInterceptStrings = 4; + const ONLY_INTERCEPT_STRINGS = 4; } diff --git a/stubs/src/RegExp/Flags.php b/stubs/src/RegExp/Flags.php index 2f17b4d..3571c10 100644 --- a/stubs/src/RegExp/Flags.php +++ b/stubs/src/RegExp/Flags.php @@ -18,10 +18,10 @@ class Flags { - const kNone = 0; - const kGlobal = 1; - const kIgnoreCase = 2; - const kMultiline = 4; - const kSticky = 8; - const kUnicode = 16; + const NONE = 0; + const GLOBAL = 1; + const IGNORE_CASE = 2; + const MULTILINE = 4; + const STICKY = 8; + const UNICODE = 16; } diff --git a/stubs/src/RegExpObject.php b/stubs/src/RegExpObject.php index fe82a16..d2c12b2 100644 --- a/stubs/src/RegExpObject.php +++ b/stubs/src/RegExpObject.php @@ -24,7 +24,7 @@ class RegExpObject extends ObjectValue * @param StringValue $pattern * @param int $flags */ - public function __construct(Context $context, StringValue $pattern, int $flags = RegExpObject\Flags::kNone) + public function __construct(Context $context, StringValue $pattern, int $flags = RegExpObject\Flags::NONE) { parent::__construct($context); } diff --git a/stubs/src/ScriptCompiler.php b/stubs/src/ScriptCompiler.php index 2eefb68..e24937b 100644 --- a/stubs/src/ScriptCompiler.php +++ b/stubs/src/ScriptCompiler.php @@ -59,7 +59,7 @@ public static function cachedDataVersionTag(): int * * @return UnboundScript */ - public static function compileUnboundScript(Context $context, Source $source, int $options = CompileOptions::kNoCompileOptions): UnboundScript + public static function compileUnboundScript(Context $context, Source $source, int $options = CompileOptions::NO_COMPILE_OPTIONS): UnboundScript { } @@ -80,7 +80,7 @@ public static function compileUnboundScript(Context $context, Source $source, in * * @return Script */ - public static function compile(Context $context, Source $source, int $options = CompileOptions::kNoCompileOptions): Script + public static function compile(Context $context, Source $source, int $options = CompileOptions::NO_COMPILE_OPTIONS): Script { } diff --git a/stubs/src/ScriptCompiler/CompileOptions.php b/stubs/src/ScriptCompiler/CompileOptions.php index 1f7ec57..129c13d 100644 --- a/stubs/src/ScriptCompiler/CompileOptions.php +++ b/stubs/src/ScriptCompiler/CompileOptions.php @@ -6,9 +6,9 @@ class CompileOptions { - const kNoCompileOptions = 0; - const kProduceParserCache = 1; - const kConsumeParserCache = 2; - const kProduceCodeCache = 3; - const kConsumeCodeCache = 4; + const NO_COMPILE_OPTIONS = 0; + const PRODUCE_PARSER_CACHE = 1; + const CONSUME_PARSER_CACHE = 2; + const PRODUCE_CODE_CACHE = 3; + const CONSUME_CODE_CACHE = 4; } diff --git a/stubs/src/StringObject.php b/stubs/src/StringObject.php index ae3abb3..38cd75b 100644 --- a/stubs/src/StringObject.php +++ b/stubs/src/StringObject.php @@ -33,7 +33,7 @@ public function __construct(Context $context, StringValue $value) /** * @return \V8\StringValue */ - public function valueOf() + public function valueOf(): StringValue { } } diff --git a/stubs/src/StringValue.php b/stubs/src/StringValue.php index 54611e3..349776a 100644 --- a/stubs/src/StringValue.php +++ b/stubs/src/StringValue.php @@ -21,7 +21,7 @@ */ class StringValue extends NameValue { - const kMaxLength = (1 << 28) - 16; + const MAX_LENGTH = (1 << 28) - 16; /** * @param Isolate $isolate diff --git a/stubs/src/Template.php b/stubs/src/Template.php index 5fb9032..8ea4b35 100644 --- a/stubs/src/Template.php +++ b/stubs/src/Template.php @@ -42,13 +42,13 @@ public function getIsolate(): Isolate /** * Adds a property to each instance created by this template. * - * @param NameValue $name - * @param PrimitiveValue|Template $value - * @param int $attributes One of \v8\PropertyAttribute constants + * @param NameValue $name + * @param Data|PrimitiveValue|Template $value + * @param int $attributes One of \V8\PropertyAttribute constants * * @return void */ - public function set(NameValue $name, /*Data*/ $value, int $attributes = PropertyAttribute::None) + public function set(NameValue $name, Data $value, int $attributes = PropertyAttribute::NONE): void { } @@ -58,14 +58,16 @@ public function set(NameValue $name, /*Data*/ $value, int $attributes = Property * @param \V8\FunctionTemplate $setter * @param int $attribute * @param int $settings + * + * @return void */ public function setAccessorProperty( NameValue $name, FunctionTemplate $getter = null, FunctionTemplate $setter = null, - $attribute = PropertyAttribute::None, + $attribute = PropertyAttribute::NONE, $settings = AccessControl::DEFAULT_ACCESS - ) { + ): void { } /** @@ -77,8 +79,8 @@ public function setAccessorProperty( * @param NameValue $name The name of the property for which an accessor is added. * * @param callable $getter The callback to invoke when getting the property. - * * Callback signature should be (NameValue $property, PropertyCallbackInfo $info) + * * @param callable $setter The callback to invoke when setting the property. * Callback signature should be (NameValue $property, PropertyCallbackInfo $info) * @@ -90,15 +92,17 @@ public function setAccessorProperty( * defined by FunctionTemplate::HasInstance()), an implicit TypeError is * thrown and no callback is invoked. * - * @param int $settings Access control settings for the accessor. + * @param int $settings Access control settings for the accessor. + * + * @return void */ public function setNativeDataProperty( NameValue $name, callable $getter, callable $setter = null, - $attribute = PropertyAttribute::None, + $attribute = PropertyAttribute::NONE, FunctionTemplate $receiver = null, $settings = AccessControl::DEFAULT_ACCESS - ) { + ): void { } } diff --git a/stubs/src/TryCatch.php b/stubs/src/TryCatch.php index fa8fea1..e296b06 100644 --- a/stubs/src/TryCatch.php +++ b/stubs/src/TryCatch.php @@ -113,7 +113,7 @@ public function getContext(): Context * @return \V8\Value|null * */ - public function exception() + public function exception(): ?Value { return $this->exception; } @@ -124,7 +124,7 @@ public function exception() * * @return \V8\Value|null */ - public function stackTrace() + public function stackTrace(): ?Value { return $this->stack_trace; } @@ -138,7 +138,7 @@ public function stackTrace() * * @return Message|null */ - public function message() + public function message(): ?Message { return $this->message; } @@ -180,7 +180,7 @@ public function hasTerminated(): bool /** * @return null|Throwable */ - public function getExternalException() + public function getExternalException(): ?Throwable { return $this->external_exception; } diff --git a/stubs/src/Value.php b/stubs/src/Value.php index 32b4e9a..88ea909 100644 --- a/stubs/src/Value.php +++ b/stubs/src/Value.php @@ -231,7 +231,7 @@ public function isRegExp(): bool * * @return \V8\BooleanValue */ - public function toBoolean(Context $context) + public function toBoolean(Context $context): BooleanValue { } @@ -240,7 +240,7 @@ public function toBoolean(Context $context) * * @return \V8\NumberValue */ - public function toNumber(Context $context) + public function toNumber(Context $context): NumberValue { } @@ -249,7 +249,7 @@ public function toNumber(Context $context) * * @return \V8\StringValue */ - public function toString(Context $context) + public function toString(Context $context): StringValue { } @@ -258,7 +258,7 @@ public function toString(Context $context) * * @return \V8\StringValue */ - public function toDetailString(Context $context) + public function toDetailString(Context $context): StringValue { } @@ -268,7 +268,7 @@ public function toDetailString(Context $context) * * @return \V8\ObjectValue */ - public function toObject(Context $context) + public function toObject(Context $context): ObjectValue { } @@ -278,7 +278,7 @@ public function toObject(Context $context) * * @return \V8\IntegerValue */ - public function toInteger(Context $context) + public function toInteger(Context $context): IntegerValue { } @@ -288,7 +288,7 @@ public function toInteger(Context $context) * * @return \V8\Uint32Value */ - public function toUint32(Context $context) + public function toUint32(Context $context): Uint32Value { } @@ -297,7 +297,7 @@ public function toUint32(Context $context) * * @return \V8\Int32Value */ - public function toInt32(Context $context) + public function toInt32(Context $context): Int32Value { } @@ -318,7 +318,7 @@ public function toArrayIndex(Context $context) * * @return bool */ - public function booleanValue(Context $context) + public function booleanValue(Context $context): bool { } @@ -327,16 +327,16 @@ public function booleanValue(Context $context) * * @return double */ - public function numberValue(Context $context) + public function numberValue(Context $context): double { } /** * @param Context $context * - * @return int | double + * @return int|double */ - public function integerValue(Context $context) + public function integerValue(Context $context): double { } @@ -345,7 +345,7 @@ public function integerValue(Context $context) * * @return int */ - public function uint32Value(Context $context) + public function uint32Value(Context $context): int { } @@ -354,7 +354,7 @@ public function uint32Value(Context $context) * * @return int */ - public function int32Value(Context $context) + public function int32Value(Context $context): int { } diff --git a/tests/.testsuite.php b/tests/.testsuite.php index 3c5d791..351c65d 100644 --- a/tests/.testsuite.php +++ b/tests/.testsuite.php @@ -197,11 +197,17 @@ public function method_matches_instanceof($object, $method, $expected, array $ar echo get_class($object), '::', $method, '() result', ($object->$method(...$args) instanceof $expected ? ' is' : ' not an'), ' instance of ', $expected, PHP_EOL; } - public function method_matches_with_output($object, $method, $expected, array $args = []) { - echo get_class($object), '::', $method, '()', ' ', ($expected === $object->$method(...$args) ? 'matches' : 'doesn\'t match'), ' expected ', var_export($expected, - true), PHP_EOL; + echo get_class($object), '::', $method, '()', ' '; + echo ($expected === ($res = $object->$method(...$args)) ? 'matches' : 'doesn\'t match'); + echo ' expected ', var_export($expected, true); + + if ($expected !== $res) { + echo ', given ', var_export($res, true); + } + + echo PHP_EOL; } public function method_matches_with_dump($object, $method, $expected, array $args = []) diff --git a/tests/001-V8_extension_info.phpt b/tests/001-extension_info.phpt similarity index 100% rename from tests/001-V8_extension_info.phpt rename to tests/001-extension_info.phpt diff --git a/tests/001-verify-method-parameters-type.phpt b/tests/001-verify-methods-signature.phpt similarity index 66% rename from tests/001-verify-method-parameters-type.phpt rename to tests/001-verify-methods-signature.phpt index 2e96773..2dddfd7 100644 --- a/tests/001-verify-method-parameters-type.phpt +++ b/tests/001-verify-methods-signature.phpt @@ -1,5 +1,5 @@ --TEST-- -Check whether all method parameters have valid type +Check whether methods signature is valid --SKIPIF-- --FILE-- @@ -25,6 +25,31 @@ class Verifier foreach ($method->getParameters() as $p) { $this->verifyParameter($p); } + + if ($method->getReturnType()) { + $type = $method->getReturnType(); + + if (!$type || $type->isBuiltin()) { + return; + } + + if(!class_exists($type) && !interface_exists($type)) { + $method_name = $method->getDeclaringClass()->getName() . '::' . $method->getDeclaringFunction()->getName(); + $shortcut = $method_name . '/return type'; + if (isset($this->invalid[$shortcut])) { + return; + } + + $this->invalid[$shortcut] = true; + + echo "{$method_name}() method's return type is invalid ($type)", PHP_EOL; + } + } + + } + + protected function verifyReturnType(ReflectionType $rt) { + } public function verifyParameter(ReflectionParameter $parameter) diff --git a/tests/001-verify_extension_entities.phpt b/tests/001-verify_extension_entities.phpt new file mode 100644 index 0000000..781d6ac --- /dev/null +++ b/tests/001-verify_extension_entities.phpt @@ -0,0 +1,896 @@ +--TEST-- +Check whether all method parameters have valid type +--SKIPIF-- + +--FILE-- +getName(), PHP_EOL; + echo 'Version: ', $re->getVersion(), PHP_EOL; + + echo PHP_EOL; + echo 'Extension-global functions:', PHP_EOL; + + if ($re->getFunctions()) { + foreach ($re->getFunctions() as $rf) { + $this->dumpFunction($rf); + } + } else { + echo 'none', PHP_EOL; + } + + echo PHP_EOL; + echo 'Extension-global constants:', PHP_EOL; + + if ($re->getConstants()) { + foreach ($re->getConstants() as $name => $value) { + echo "$name = ", var_export($value, true), PHP_EOL; + } + } else { + echo 'none', PHP_EOL; + } + + echo PHP_EOL; + echo 'Extension-global classes:', PHP_EOL; + + if ($re->getClasses()) { + foreach ($re->getClasses() as $rc) { + $this->dumpClass($rc); + echo PHP_EOL; + } + } else { + echo 'none', PHP_EOL; + } + + + } + + protected function dumpClass(ReflectionClass $rc) + { + if ($rc->isTrait()) { + echo 'trait '; + } elseif ($rc->isInterface()) { + echo 'interface '; + } else { + if ($rc->isAbstract()) { + echo 'abstract '; + } + + if ($rc->isFinal()) { + echo 'final '; + } + + echo 'class '; + } + + echo $rc->getName(), PHP_EOL; + + if ($rc->getParentClass()) { + echo ' extends ', $rc->getParentClass()->getName(), PHP_EOL; + } + + foreach ($rc->getInterfaces() as $ri) { + echo ' implements ', $ri->getName(), PHP_EOL; + } + + foreach ($rc->getTraits() as $rt) { + echo ' use ', $rt->getName(), PHP_EOL; + } + + foreach ($rc->getConstants() as $name => $value) { + echo " const {$name} = ", var_export($value, true), PHP_EOL; + } + + foreach ($rc->getProperties() as $rp) { + if ($rp->getDeclaringClass() != $rc) { + continue; + } + + echo ' '; + + if ($rp->isStatic()) { + echo 'static '; + } + + + if ($rp->isPublic()) { + echo 'public '; + } + + if ($rp->isProtected()) { + echo 'protected '; + } + + if ($rp->isPrivate()) { + echo 'private '; + } + + echo '$', $rp->getName(); + echo PHP_EOL; + } + + + + foreach ($rc->getMethods() as $rm) { + if ($rm->getDeclaringClass() != $rc) { + continue; + } + + echo ' '; + + if ($rm->isAbstract()) { + echo 'abstract '; + } + + if ($rm->isFinal()) { + echo 'final '; + } + + if ($rm->isPublic()) { + echo 'public '; + } + + if ($rm->isProtected()) { + echo 'protected '; + } + + if ($rm->isPrivate()) { + echo 'private '; + } + + if ($rm->isStatic()) { + echo 'static '; + } + + echo 'function ', $rm->getName(); + echo $this->dumpPartialFunction($rm), PHP_EOL; + } + } + + protected function dumpFunction(ReflectionFunction $rf) + { + if ($rf->inNamespace()) { + echo $rf->getNamespaceName(), ': '; + } + + echo 'function ', $rf->getName(); + + echo $this->dumpPartialFunction($rf); + echo PHP_EOL; + } + + protected function dumpPartialFunction(ReflectionFunctionAbstract $rf) + { + $ret = '('; + + $parameters = []; + foreach ($rf->getParameters() as $parameter) { + $parameters[] = $this->dumpParameter($parameter); + } + + $ret .= implode(', ', $parameters); + + $ret .= ')'; + + if ($rf->hasReturnType()) { + $ret .= ': ' . ($rf->getReturnType()->allowsNull() ? '?' : '') . $rf->getReturnType(); + } + + return $ret; + } + + protected function dumpParameter(ReflectionParameter $rp) + { + $ret = []; + + $ret[] = $rp->hasType() ? ($rp->allowsNull() ? '?' : '') . (string)$rp->getType() : null; + $ret[] = ($rp->isVariadic() ? '...' : '') . "\${$rp->getName()}"; + + // $ret[] = $rp->isOptional() ? '= ?' : ''; + + return trim(implode(' ', $ret)); + } +} + +$d = new Dumper(); + +$d->dumpExtension(); + +// EXPECTF: ---/Version: .+/ +// EXPECTF: +++Version: %s + +?> +--EXPECTF-- +Name: v8 +Version: %s + +Extension-global functions: +none + +Extension-global constants: +none + +Extension-global classes: +final class V8\AccessControl + const DEFAULT_ACCESS = 0 + const ALL_CAN_READ = 1 + const ALL_CAN_WRITE = 2 + +final class V8\ConstructorBehavior + const THROW = 0 + const ALLOW = 1 + +final class V8\IntegrityLevel + const FROZEN = 0 + const SEALED = 1 + +final class V8\PropertyAttribute + const NONE = 0 + const READ_ONLY = 1 + const DONT_ENUM = 2 + const DONT_DELETE = 4 + +final class V8\PropertyHandlerFlags + const NONE = 0 + const ALL_CAN_READ = 1 + const NON_MASKING = 2 + const ONLY_INTERCEPT_STRINGS = 4 + +final class V8\PropertyFilter + const ALL_PROPERTIES = 0 + const ONLY_WRITABLE = 1 + const ONLY_ENUMERABLE = 2 + const ONLY_CONFIGURABLE = 4 + const SKIP_STRINGS = 8 + const SKIP_SYMBOLS = 16 + +final class V8\KeyCollectionMode + const OWN_ONLY = 0 + const INCLUDE_PROTOTYPES = 1 + +final class V8\IndexFilter + const INCLUDE_INDICES = 0 + const SKIP_INDICES = 1 + +class V8\Exceptions\Exception + extends Exception + implements Throwable + +class V8\Exceptions\TryCatchException + extends V8\Exceptions\Exception + implements Throwable + private $isolate + private $context + private $try_catch + public function __construct(V8\Isolate $isolate, V8\Context $context, V8\TryCatch $try_catch) + public function getIsolate(): V8\Isolate + public function getContext(): V8\Context + public function getTryCatch(): V8\TryCatch + +class V8\Exceptions\TerminationException + extends V8\Exceptions\TryCatchException + implements Throwable + +class V8\Exceptions\ResourceLimitException + extends V8\Exceptions\TerminationException + implements Throwable + +class V8\Exceptions\TimeLimitException + extends V8\Exceptions\ResourceLimitException + implements Throwable + +class V8\Exceptions\MemoryLimitException + extends V8\Exceptions\ResourceLimitException + implements Throwable + +class V8\Exceptions\ValueException + extends V8\Exceptions\Exception + implements Throwable + +interface V8\AdjustableExternalMemoryInterface + abstract public function adjustExternalAllocatedMemory(int $change_in_bytes): int + abstract public function getExternalAllocatedMemory(): int + +class V8\HeapStatistics + private $total_heap_size + private $total_heap_size_executable + private $total_physical_size + private $total_available_size + private $used_heap_size + private $heap_size_limit + private $malloced_memory + private $peak_malloced_memory + private $does_zap_garbage + public function __construct(float $total_heap_size, float $total_heap_size_executable, float $total_physical_size, float $total_available_size, float $used_heap_size, float $heap_size_limit, float $malloced_memory, float $peak_malloced_memory, bool $does_zap_garbage) + public function getTotalHeapSize(): float + public function getTotalHeapSizeExecutable(): float + public function getTotalPhysicalSize(): float + public function getTotalAvailableSize(): float + public function getUsedHeapSize(): float + public function getHeapSizeLimit(): float + public function getMallocedMemory(): float + public function getPeakMallocedMemory(): float + public function doesZapGarbage(): bool + +class V8\StartupData + public function __construct(string $blob) + public function getData(): string + public function getRawSize(): int + public static function createFromSource(string $source): V8\StartupData + +class V8\Isolate + public function __construct(?V8\StartupData $snapshot) + public function setTimeLimit(float $time_limit_in_seconds) + public function getTimeLimit(): float + public function isTimeLimitHit(): bool + public function setMemoryLimit(int $memory_limit_in_bytes) + public function getMemoryLimit(): int + public function isMemoryLimitHit(): bool + public function getHeapStatistics(): V8\HeapStatistics + public function inContext(): bool + public function getEnteredContext(): V8\Context + public function throwException(V8\Context $context, V8\Value $value, Throwable $e) + public function idleNotificationDeadline($deadline_in_seconds): bool + public function lowMemoryNotification() + public function terminateExecution() + public function isExecutionTerminating(): bool + public function cancelTerminateExecution() + public function isDead(): bool + public function isInUse(): bool + public function setCaptureStackTraceForUncaughtExceptions(bool $capture, int $frame_limit) + +class V8\Context + private $isolate + public function __construct(V8\Isolate $isolate, ?V8\ObjectTemplate $global_template, ?V8\ObjectValue $global_object) + public function getIsolate(): V8\Isolate + public function globalObject(): V8\ObjectValue + public function detachGlobal() + public function setSecurityToken(V8\Value $token) + public function useDefaultSecurityToken() + public function getSecurityToken(): V8\Value + public function allowCodeGenerationFromStrings(bool $allow) + public function isCodeGenerationFromStringsAllowed(): bool + public function setErrorMessageForCodeGenerationFromStrings(V8\StringValue $message) + +class V8\Script + private $isolate + private $context + public function __construct(V8\Context $context, V8\StringValue $source, V8\ScriptOrigin $origin) + public function getIsolate(): V8\Isolate + public function getContext(): V8\Context + public function run(V8\Context $context): V8\Value + public function getUnboundScript(): V8\UnboundScript + +class V8\UnboundScript + const kNoScriptId = 0 + private $isolate + private function __construct() + public function getIsolate(): V8\Isolate + public function bindToContext(V8\Context $context): V8\Script + public function getId(): int + public function getScriptName(): V8\Value + public function getSourceURL(): V8\Value + public function getSourceMappingURL(): V8\Value + public function getLineNumber(int $code_pos): int + +class V8\ScriptCompiler\CachedData + public function __construct(string $data) + public function getData(): string + public function isRejected(): bool + +class V8\ScriptCompiler\Source + private $source_string + private $origin + private $cached_data + public function __construct(V8\StringValue $source_string, ?V8\ScriptOrigin $origin, ?V8\ScriptCompiler\CachedData $cached_data) + public function getSourceString(): V8\StringValue + public function getScriptOrigin(): ?V8\ScriptOrigin + public function getCachedData(): ?V8\ScriptCompiler\CachedData + +class V8\ScriptCompiler + public static function cachedDataVersionTag(): int + public static function compileUnboundScript(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\UnboundScript + public static function compile(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\Script + public static function compileFunctionInContext(V8\Context $context, V8\ScriptCompiler\Source $source, array $arguments, array $context_extensions): V8\FunctionObject + +final class V8\ScriptCompiler\CompileOptions + const NO_COMPILE_OPTIONS = 0 + const PRODUCE_PARSER_CACHE = 1 + const CONSUME_PARSER_CACHE = 2 + const PRODUCE_CODE_CACHE = 3 + const CONSUME_CODE_CACHE = 4 + +class V8\ExceptionManager + public static function createRangeError(V8\Context $context, V8\StringValue $message): V8\ObjectValue + public static function createReferenceError(V8\Context $context, V8\StringValue $message): V8\ObjectValue + public static function createSyntaxError(V8\Context $context, V8\StringValue $message): V8\ObjectValue + public static function createTypeError(V8\Context $context, V8\StringValue $message): V8\ObjectValue + public static function createError(V8\Context $context, V8\StringValue $message): V8\ObjectValue + public static function createMessage(V8\Context $context, V8\Value $exception): V8\Message + public static function getStackTrace(V8\Context $context, V8\Value $exception): ?V8\StackTrace + +class V8\TryCatch + private $isolate + private $context + private $exception + private $stack_trace + private $message + private $can_continue + private $has_terminated + private $external_exception + public function __construct(V8\Isolate $isolate, V8\Context $context, ?V8\Value $exception, ?V8\Value $stack_trace, ?V8\Message $message, bool $can_continue, bool $has_terminated, ?Throwable $external_exception) + public function getIsolate(): V8\Isolate + public function getContext(): V8\Context + public function exception(): ?V8\Value + public function stackTrace(): ?V8\Value + public function message(): ?V8\Message + public function canContinue(): bool + public function hasTerminated(): bool + public function getExternalException(): ?Throwable + +class V8\Message + const kNoLineNumberInfo = 0 + const kNoColumnInfo = 0 + const kNoScriptIdInfo = 0 + private $message + private $script_origin + private $source_line + private $resource_name + private $stack_trace + private $line_number + private $start_position + private $end_position + private $start_column + private $end_column + private $is_shared_cross_origin + private $is_opaque + public function __construct(string $message, string $source_line, V8\ScriptOrigin $script_origin, string $resource_name, V8\StackTrace $stack_trace, int $line_number, int $start_position, int $end_position, int $start_column, int $end_column, bool $is_shared_cross_origin, bool $is_opaque) + public function get(): string + public function getSourceLine(): string + public function getScriptOrigin(): V8\ScriptOrigin + public function getScriptResourceName(): string + public function getStackTrace(): ?V8\StackTrace + public function getLineNumber(): int + public function getStartPosition(): int + public function getEndPosition(): int + public function getStartColumn(): int + public function getEndColumn(): int + public function isSharedCrossOrigin(): bool + public function isOpaque(): bool + +class V8\StackFrame + private $line_number + private $column + private $script_id + private $script_name + private $script_name_or_source_url + private $function_name + private $is_eval + private $is_constructor + public function __construct(int $line_number, int $column, int $script_id, string $script_name, string $script_name_or_source_url, string $function_name, bool $is_eval, bool $is_constructor) + public function getLineNumber(): int + public function getColumn(): int + public function getScriptId(): int + public function getScriptName(): string + public function getScriptNameOrSourceURL(): string + public function getFunctionName(): string + public function isEval(): bool + public function isConstructor(): bool + +class V8\StackTrace + const MIN_FRAME_LIMIT = 0 + const MAX_FRAME_LIMIT = 1000 + private $frames + public function __construct(array $frames) + public function getFrames(): array + public function getFrame(int $index): V8\StackFrame + public function getFrameCount(): int + public static function currentStackTrace(V8\Isolate $isolate, int $frame_limit): V8\StackTrace + +class V8\ScriptOriginOptions + private $is_shared_cross_origin + private $is_opaque + private $is_wasm + private $is_module + public function __construct(bool $is_shared_cross_origin, bool $is_opaque, bool $is_wasm, bool $is_module) + public function isSharedCrossOrigin(): bool + public function isOpaque(): bool + public function isWasm(): bool + public function isModule(): bool + +class V8\ScriptOrigin + private $resource_name + private $resource_line_offset + private $resource_column_offset + private $options + private $script_id + private $source_map_url + public function __construct(string $resource_name, int $resource_line_offset, int $resource_column_offset, bool $resource_is_shared_cross_origin, int $script_id, string $source_map_url, bool $resource_is_opaque) + public function resourceName(): string + public function resourceLineOffset(): int + public function resourceColumnOffset(): int + public function scriptId(): int + public function sourceMapUrl(): string + public function options(): V8\ScriptOriginOptions + +class V8\Data + +abstract class V8\Value + extends V8\Data + private $isolate + public function getIsolate(): V8\Isolate + public function isUndefined(): bool + public function isNull(): bool + public function isNullOrUndefined(): bool + public function isTrue(): bool + public function isFalse(): bool + public function isName(): bool + public function isString(): bool + public function isSymbol(): bool + public function isFunction(): bool + public function isArray(): bool + public function isObject(): bool + public function isBoolean(): bool + public function isNumber(): bool + public function isInt32(): bool + public function isUint32(): bool + public function isDate(): bool + public function isArgumentsObject(): bool + public function isBooleanObject(): bool + public function isNumberObject(): bool + public function isStringObject(): bool + public function isSymbolObject(): bool + public function isNativeError(): bool + public function isRegExp(): bool + public function isAsyncFunction(): bool + public function isGeneratorFunction(): bool + public function isGeneratorObject(): bool + public function isPromise(): bool + public function isMap(): bool + public function isSet(): bool + public function isMapIterator(): bool + public function isSetIterator(): bool + public function isWeakMap(): bool + public function isWeakSet(): bool + public function isArrayBuffer(): bool + public function isArrayBufferView(): bool + public function isTypedArray(): bool + public function isUint8Array(): bool + public function isUint8ClampedArray(): bool + public function isInt8Array(): bool + public function isUint16Array(): bool + public function isInt16Array(): bool + public function isUint32Array(): bool + public function isInt32Array(): bool + public function isFloat32Array(): bool + public function isFloat64Array(): bool + public function isDataView(): bool + public function isSharedArrayBuffer(): bool + public function isProxy(): bool + public function toBoolean(V8\Context $context): V8\BooleanValue + public function toNumber(V8\Context $context): V8\NumberValue + public function toString(V8\Context $context): V8\StringValue + public function toDetailString(V8\Context $context): V8\StringValue + public function toObject(V8\Context $context): V8\ObjectValue + public function toInteger(V8\Context $context): V8\IntegerValue + public function toUint32(V8\Context $context): V8\Uint32Value + public function toInt32(V8\Context $context): V8\Int32Value + public function toArrayIndex(V8\Context $context): V8\Uint32Value + public function booleanValue(V8\Context $context): bool + public function numberValue(V8\Context $context): float + public function integerValue(V8\Context $context): float + public function int32Value(V8\Context $context): int + public function uint32Value(V8\Context $context): int + public function equals(V8\Context $context, V8\Value $that): ?bool + public function strictEquals(V8\Value $that): bool + public function sameValue(V8\Value $that): bool + public function typeOf(): V8\StringValue + public function instanceOf(V8\Context $context, V8\ObjectValue $object): bool + +abstract class V8\PrimitiveValue + extends V8\Value + +class V8\UndefinedValue + extends V8\PrimitiveValue + public function __construct(V8\Isolate $isolate) + public function value() + +class V8\NullValue + extends V8\PrimitiveValue + public function __construct(V8\Isolate $isolate) + public function value() + +class V8\BooleanValue + extends V8\PrimitiveValue + public function __construct(V8\Isolate $isolate, bool $value) + public function value(): bool + +abstract class V8\NameValue + extends V8\PrimitiveValue + public function getIdentityHash(): int + +class V8\StringValue + extends V8\NameValue + const MAX_LENGTH = 268435440 + public function __construct(V8\Isolate $isolate, $data) + public function value(): string + public function length(): int + public function utf8Length(): int + public function isOneByte(): bool + public function containsOnlyOneByte(): bool + +class V8\SymbolValue + extends V8\NameValue + public function __construct(V8\Isolate $isolate, ?V8\StringValue $name) + public function value(): string + public function name(): V8\Value + public static function for(V8\Context $context, V8\StringValue $name): V8\SymbolValue + public static function forApi(V8\Context $context, V8\StringValue $name): V8\SymbolValue + public static function getHasInstance(V8\Isolate $isolate): V8\SymbolValue + public static function getIsConcatSpreadable(V8\Isolate $isolate): V8\SymbolValue + public static function getIterator(V8\Isolate $isolate): V8\SymbolValue + public static function getMatch(V8\Isolate $isolate): V8\SymbolValue + public static function getReplace(V8\Isolate $isolate): V8\SymbolValue + public static function getSearch(V8\Isolate $isolate): V8\SymbolValue + public static function getSplit(V8\Isolate $isolate): V8\SymbolValue + public static function getToPrimitive(V8\Isolate $isolate): V8\SymbolValue + public static function getToStringTag(V8\Isolate $isolate): V8\SymbolValue + public static function getUnscopables(V8\Isolate $isolate): V8\SymbolValue + +class V8\NumberValue + extends V8\PrimitiveValue + public function __construct(V8\Isolate $isolate, float $value) + public function value() + +class V8\IntegerValue + extends V8\NumberValue + public function __construct(V8\Isolate $isolate, int $value) + public function value(): int + +class V8\Int32Value + extends V8\IntegerValue + public function __construct(V8\Isolate $isolate, int $value) + public function value(): int + +class V8\Uint32Value + extends V8\IntegerValue + public function __construct(V8\Isolate $isolate, int $value) + public function value(): int + +class V8\ObjectValue + extends V8\Value + implements V8\AdjustableExternalMemoryInterface + private $context + public function __construct(V8\Context $context) + public function getContext(): V8\Context + public function set(V8\Context $context, V8\Value $key, V8\Value $value) + public function createDataProperty(V8\Context $context, V8\NameValue $key, V8\Value $value): bool + public function defineOwnProperty(V8\Context $context, V8\NameValue $key, V8\Value $value, $attributes): bool + public function get(V8\Context $context, V8\Value $key): V8\Value + public function getPropertyAttributes(V8\Context $context, V8\StringValue $key): int + public function getOwnPropertyDescriptor(V8\Context $context, V8\StringValue $key): V8\Value + public function has(V8\Context $context, V8\Value $key): bool + public function delete(V8\Context $context, V8\Value $key): bool + public function setAccessor(V8\Context $context, V8\NameValue $name, callable $getter, ?callable $setter, int $settings, int $attributes): bool + public function setAccessorProperty(V8\NameValue $name, V8\FunctionObject $getter, V8\FunctionObject $setter, int $attributes, int $settings) + public function setNativeDataProperty(V8\Context $context, V8\NameValue $name, callable $getter, ?callable $setter, int $attributes): bool + public function getPropertyNames(V8\Context $context, int $mode, int $property_filter, int $index_filter): V8\ArrayObject + public function getOwnPropertyNames(V8\Context $context, int $filter): V8\ArrayObject + public function getPrototype(): V8\Value + public function setPrototype(V8\Context $context, V8\Value $prototype): bool + public function findInstanceInPrototypeChain(V8\FunctionTemplate $tmpl): V8\ObjectValue + public function objectProtoToString(V8\Context $context): V8\StringValue + public function getConstructorName(): V8\StringValue + public function setIntegrityLevel(V8\Context $context, int $level): bool + public function hasOwnProperty(V8\Context $context, $key): bool + public function hasRealNamedProperty(V8\Context $context, $key): bool + public function hasRealIndexedProperty(V8\Context $context, $index): bool + public function hasRealNamedCallbackProperty(V8\Context $context, $key): bool + public function getRealNamedPropertyInPrototypeChain(V8\Context $context, $key): V8\Value + public function getRealNamedPropertyAttributesInPrototypeChain(V8\Context $context, $key): int + public function getRealNamedProperty(V8\Context $context, $key): V8\Value + public function getRealNamedPropertyAttributes(V8\Context $context, $key): int + public function hasNamedLookupInterceptor(): bool + public function hasIndexedLookupInterceptor(): bool + public function getIdentityHash(): int + public function clone(): V8\ObjectValue + public function isCallable(): bool + public function isConstructor(): bool + public function callAsFunction(V8\Context $context, V8\Value $recv, array $arguments): V8\Value + public function callAsConstructor(V8\Context $context, array $arguments): V8\Value + public function adjustExternalAllocatedMemory(int $change_in_bytes): int + public function getExternalAllocatedMemory(): int + +class V8\FunctionObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, callable $callback, int $length) + public function newInstance(V8\Context $context, array $arguments): V8\ObjectValue + public function call(V8\Context $context, V8\Value $recv, array $arguments): V8\Value + public function setName(V8\StringValue $name) + public function getName(): V8\Value + public function getInferredName(): V8\Value + public function getDisplayName(): V8\Value + public function getScriptLineNumber(): ?int + public function getScriptColumnNumber(): ?int + public function getScriptId(): ?int + public function getBoundFunction(): V8\Value + public function getScriptOrigin(): V8\ScriptOrigin + +class V8\ArrayObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, int $length) + public function length(): int + +class V8\MapObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context) + public function size(): float + public function clear() + public function get(V8\Context $context, V8\Value $key): V8\Value + public function set(V8\Context $context, V8\Value $key, V8\Value $value): V8\MapObject + public function has(V8\Context $context, V8\Value $key): bool + public function delete(V8\Context $context, V8\Value $key): bool + public function asArray(): V8\ArrayObject + +class V8\SetObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context) + public function size(): float + public function clear() + public function add(V8\Context $context, V8\Value $key): V8\SetObject + public function has(V8\Context $context, V8\Value $key): bool + public function delete(V8\Context $context, V8\Value $key): bool + public function asArray(): V8\ArrayObject + +class V8\DateObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, float $time) + public function valueOf(): float + public static function dateTimeConfigurationChangeNotification(V8\isolate $isolate) + +class V8\RegExpObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, V8\StringValue $context, ?int $flags) + public function getSource(): V8\StringValue + public function getFlags(): int + +final class V8\RegExpObject\Flags + const NONE = 0 + const GLOBAL = 1 + const IGNORE_CASE = 2 + const MULTILINE = 4 + const STICKY = 8 + const UNICODE = 16 + +class V8\NumberObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, $value) + public function valueOf(): float + +class V8\BooleanObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, bool $value) + public function valueOf(): bool + +class V8\StringObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, V8\StringValue $value) + public function valueOf(): V8\StringValue + +class V8\SymbolObject + extends V8\ObjectValue + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Context $context, V8\SymbolValue $value) + public function valueOf(): V8\SymbolValue + +abstract class V8\Template + extends V8\Data + private $isolate + abstract public function getIsolate(): V8\Isolate + abstract public function set(V8\NameValue $name, V8\Data $value, int $attributes) + abstract public function setAccessorProperty(V8\NameValue $name, V8\FunctionTemplate $getter, V8\FunctionTemplate $setter, int $attributes, int $settings) + abstract public function setNativeDataProperty(V8\NameValue $name, callable $getter, ?callable $setter, int $attributes, ?V8\FunctionTemplate $receiver, int $settings) + +class V8\ObjectTemplate + extends V8\Template + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Isolate $isolate, ?V8\FunctionTemplate $constructor) + public function getIsolate(): V8\Isolate + public function set(V8\NameValue $name, V8\Data $value, int $attributes) + public function setAccessorProperty(V8\NameValue $name, V8\FunctionTemplate $getter, V8\FunctionTemplate $setter, int $attributes, int $settings) + public function setNativeDataProperty(V8\NameValue $name, callable $getter, ?callable $setter, int $attributes, ?V8\FunctionTemplate $receiver, int $settings) + public function newInstance(V8\Context $value): V8\ObjectValue + public function setAccessor(V8\NameValue $name, callable $getter, ?callable $setter, int $settings, int $attributes, ?V8\FunctionTemplate $receiver) + public function setHandlerForNamedProperty(V8\NamedPropertyHandlerConfiguration $configuration) + public function setHandlerForIndexedProperty(V8\IndexedPropertyHandlerConfiguration $configuration) + public function setCallAsFunctionHandler($callback) + public function adjustExternalAllocatedMemory(int $change_in_bytes): int + public function getExternalAllocatedMemory(): int + +class V8\FunctionTemplate + extends V8\Template + implements V8\AdjustableExternalMemoryInterface + public function __construct(V8\Isolate $isolate, ?callable $callback, ?V8\FunctionTemplate $receiver, int $length, int $behavior) + public function getIsolate(): V8\Isolate + public function set(V8\NameValue $name, V8\Data $value, int $attributes) + public function setAccessorProperty(V8\NameValue $name, V8\FunctionTemplate $getter, V8\FunctionTemplate $setter, int $attributes, int $settings) + public function setNativeDataProperty(V8\NameValue $name, callable $getter, ?callable $setter, int $attributes, ?V8\FunctionTemplate $receiver, int $settings) + public function getFunction(V8\Context $context): V8\FunctionObject + public function setCallHandler(callable $callback) + public function setLength(int $length) + public function instanceTemplate(): V8\ObjectTemplate + public function inherit(V8\FunctionTemplate $parent) + public function prototypeTemplate(): V8\ObjectTemplate + public function setClassName(V8\StringValue $name) + public function setAcceptAnyReceiver(bool $value) + public function setHiddenPrototype(bool $value) + public function readOnlyPrototype() + public function removePrototype() + public function hasInstance(V8\ObjectValue $object): bool + public function adjustExternalAllocatedMemory(int $change_in_bytes): int + public function getExternalAllocatedMemory(): int + +class V8\ReturnValue + private $isolate + private $context + public function get(): V8\Value + public function set(V8\Value $value) + public function setNull() + public function setUndefined() + public function setEmptyString() + public function setBool(bool $value) + public function setInteger(int $i) + public function setFloat(float $i) + public function getIsolate(): V8\Isolate + public function getContext(): V8\Context + public function inContext(): bool + +class V8\CallbackInfo + private $isolate + private $context + private $this + private $holder + private $return_value + public function this(): V8\ObjectValue + public function holder(): V8\ObjectValue + public function getIsolate(): V8\Isolate + public function getContext(): V8\Context + public function getReturnValue(): V8\ReturnValue + +class V8\PropertyCallbackInfo + extends V8\CallbackInfo + private $should_throw_on_error + public function shouldThrowOnError(): bool + +class V8\FunctionCallbackInfo + extends V8\CallbackInfo + private $arguments + private $new_target + private $is_constructor_call + public function length(): int + public function arguments(): array + public function newTarget(): V8\Value + public function isConstructCall(): bool + +class V8\NamedPropertyHandlerConfiguration + public function __construct(callable $getter, ?callable $setter, ?callable $query, ?callable $deleter, ?callable $enumerator, int $flags) + +class V8\IndexedPropertyHandlerConfiguration + public function __construct(callable $getter, ?callable $setter, ?callable $query, ?callable $deleter, ?callable $enumerator, int $flags) diff --git a/tests/002-enums.phpt b/tests/002-enums.phpt index c8436bd..030b169 100644 --- a/tests/002-enums.phpt +++ b/tests/002-enums.phpt @@ -20,15 +20,17 @@ $enums = [ new V8\KeyCollectionMode(), new V8\IndexFilter(), new V8\RegExpObject\Flags(), - new V8\ScriptCompiler\CompileOptions, + new V8\ScriptCompiler\CompileOptions(), ]; foreach ($enums as $enum) { + $rc = new ReflectionClass($enum); + $helper->header('Object representation'); + $helper->assert('Class is final', $rc->isFinal()); $helper->dump($enum); $helper->space(); - $helper->header('Class constants'); $helper->dump_object_constants($enum); $helper->space(); @@ -39,6 +41,7 @@ foreach ($enums as $enum) { --EXPECT-- Object representation: ---------------------- +Class is final: ok object(V8\AccessControl)#2 (0) { } @@ -52,58 +55,63 @@ V8\AccessControl::ALL_CAN_WRITE = 2 Object representation: ---------------------- +Class is final: ok object(V8\ConstructorBehavior)#3 (0) { } Class constants: ---------------- -V8\ConstructorBehavior::kThrow = 0 -V8\ConstructorBehavior::kAllow = 1 +V8\ConstructorBehavior::THROW = 0 +V8\ConstructorBehavior::ALLOW = 1 Object representation: ---------------------- +Class is final: ok object(V8\IntegrityLevel)#4 (0) { } Class constants: ---------------- -V8\IntegrityLevel::kFrozen = 0 -V8\IntegrityLevel::kSealed = 1 +V8\IntegrityLevel::FROZEN = 0 +V8\IntegrityLevel::SEALED = 1 Object representation: ---------------------- +Class is final: ok object(V8\PropertyAttribute)#5 (0) { } Class constants: ---------------- -V8\PropertyAttribute::None = 0 -V8\PropertyAttribute::ReadOnly = 1 -V8\PropertyAttribute::DontEnum = 2 -V8\PropertyAttribute::DontDelete = 4 +V8\PropertyAttribute::NONE = 0 +V8\PropertyAttribute::READ_ONLY = 1 +V8\PropertyAttribute::DONT_ENUM = 2 +V8\PropertyAttribute::DONT_DELETE = 4 Object representation: ---------------------- +Class is final: ok object(V8\PropertyHandlerFlags)#6 (0) { } Class constants: ---------------- -V8\PropertyHandlerFlags::kNone = 0 -V8\PropertyHandlerFlags::kAllCanRead = 1 -V8\PropertyHandlerFlags::kNonMasking = 2 -V8\PropertyHandlerFlags::kOnlyInterceptStrings = 4 +V8\PropertyHandlerFlags::NONE = 0 +V8\PropertyHandlerFlags::ALL_CAN_READ = 1 +V8\PropertyHandlerFlags::NON_MASKING = 2 +V8\PropertyHandlerFlags::ONLY_INTERCEPT_STRINGS = 4 Object representation: ---------------------- +Class is final: ok object(V8\PropertyFilter)#7 (0) { } @@ -120,54 +128,58 @@ V8\PropertyFilter::SKIP_SYMBOLS = 16 Object representation: ---------------------- +Class is final: ok object(V8\KeyCollectionMode)#8 (0) { } Class constants: ---------------- -V8\KeyCollectionMode::kOwnOnly = 0 -V8\KeyCollectionMode::kIncludePrototypes = 1 +V8\KeyCollectionMode::OWN_ONLY = 0 +V8\KeyCollectionMode::INCLUDE_PROTOTYPES = 1 Object representation: ---------------------- +Class is final: ok object(V8\IndexFilter)#9 (0) { } Class constants: ---------------- -V8\IndexFilter::kIncludeIndices = 0 -V8\IndexFilter::kSkipIndices = 1 +V8\IndexFilter::INCLUDE_INDICES = 0 +V8\IndexFilter::SKIP_INDICES = 1 Object representation: ---------------------- +Class is final: ok object(V8\RegExpObject\Flags)#10 (0) { } Class constants: ---------------- -V8\RegExpObject\Flags::kNone = 0 -V8\RegExpObject\Flags::kGlobal = 1 -V8\RegExpObject\Flags::kIgnoreCase = 2 -V8\RegExpObject\Flags::kMultiline = 4 -V8\RegExpObject\Flags::kSticky = 8 -V8\RegExpObject\Flags::kUnicode = 16 +V8\RegExpObject\Flags::NONE = 0 +V8\RegExpObject\Flags::GLOBAL = 1 +V8\RegExpObject\Flags::IGNORE_CASE = 2 +V8\RegExpObject\Flags::MULTILINE = 4 +V8\RegExpObject\Flags::STICKY = 8 +V8\RegExpObject\Flags::UNICODE = 16 Object representation: ---------------------- +Class is final: ok object(V8\ScriptCompiler\CompileOptions)#11 (0) { } Class constants: ---------------- -V8\ScriptCompiler\CompileOptions::kNoCompileOptions = 0 -V8\ScriptCompiler\CompileOptions::kProduceParserCache = 1 -V8\ScriptCompiler\CompileOptions::kConsumeParserCache = 2 -V8\ScriptCompiler\CompileOptions::kProduceCodeCache = 3 -V8\ScriptCompiler\CompileOptions::kConsumeCodeCache = 4 +V8\ScriptCompiler\CompileOptions::NO_COMPILE_OPTIONS = 0 +V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE = 1 +V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE = 2 +V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE = 3 +V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE = 4 diff --git a/tests/010-no-value-self-cleanup-on-shutdown.phpt b/tests/010-no-value-self-cleanup-on-shutdown.phpt new file mode 100644 index 0000000..bd323ed --- /dev/null +++ b/tests/010-no-value-self-cleanup-on-shutdown.phpt @@ -0,0 +1,25 @@ +--TEST-- +Built-in enum classes +--SKIPIF-- + +--FILE-- + +--EXPECT-- +done diff --git a/tests/V8ArrayObject.phpt b/tests/ArrayObject.phpt similarity index 100% rename from tests/V8ArrayObject.phpt rename to tests/ArrayObject.phpt diff --git a/tests/V8ArrayObject_length.phpt b/tests/ArrayObject_length.phpt similarity index 100% rename from tests/V8ArrayObject_length.phpt rename to tests/ArrayObject_length.phpt diff --git a/tests/V8Boolean.phpt b/tests/Boolean.phpt similarity index 100% rename from tests/V8Boolean.phpt rename to tests/Boolean.phpt diff --git a/tests/V8BooleanObject.phpt b/tests/BooleanObject.phpt similarity index 100% rename from tests/V8BooleanObject.phpt rename to tests/BooleanObject.phpt diff --git a/tests/V8CachedData.phpt b/tests/CachedData.phpt similarity index 100% rename from tests/V8CachedData.phpt rename to tests/CachedData.phpt diff --git a/tests/V8Context.phpt b/tests/Context.phpt similarity index 100% rename from tests/V8Context.phpt rename to tests/Context.phpt diff --git a/tests/V8Context_globalObject.phpt b/tests/Context_globalObject.phpt similarity index 100% rename from tests/V8Context_globalObject.phpt rename to tests/Context_globalObject.phpt diff --git a/tests/V8Context_invalid_ctor_arg_type.phpt b/tests/Context_invalid_ctor_arg_type.phpt similarity index 100% rename from tests/V8Context_invalid_ctor_arg_type.phpt rename to tests/Context_invalid_ctor_arg_type.phpt diff --git a/tests/V8Context_reference_lifecycle.phpt b/tests/Context_reference_lifecycle.phpt similarity index 100% rename from tests/V8Context_reference_lifecycle.phpt rename to tests/Context_reference_lifecycle.phpt diff --git a/tests/V8Context_setSecurityToken.phpt b/tests/Context_setSecurityToken.phpt similarity index 100% rename from tests/V8Context_setSecurityToken.phpt rename to tests/Context_setSecurityToken.phpt diff --git a/tests/V8Context_weakness.phpt b/tests/Context_weakness.phpt similarity index 100% rename from tests/V8Context_weakness.phpt rename to tests/Context_weakness.phpt diff --git a/tests/V8Data.phpt b/tests/Data.phpt similarity index 100% rename from tests/V8Data.phpt rename to tests/Data.phpt diff --git a/tests/V8DateObject.phpt b/tests/DateObject.phpt similarity index 100% rename from tests/V8DateObject.phpt rename to tests/DateObject.phpt diff --git a/tests/V8Exception_createMessage.phpt b/tests/ExceptionManager_createCreateMessage.phpt similarity index 96% rename from tests/V8Exception_createMessage.phpt rename to tests/ExceptionManager_createCreateMessage.phpt index 2aee6e9..5277f60 100644 --- a/tests/V8Exception_createMessage.phpt +++ b/tests/ExceptionManager_createCreateMessage.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::createMessage() +V8\ExceptionManager::createCreateMessage() --SKIPIF-- --FILE-- @@ -13,7 +13,7 @@ $isolate = new \V8\Isolate(); $context = new \V8\Context($isolate); try { - $message = V8\Exception::createMessage($context, new \V8\StringValue($isolate, 'test')); + $message = V8\ExceptionManager::createMessage($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can create message when out of context', $message instanceof \V8\Message); } catch (\Exception $e) { $helper->exception_export($e); @@ -29,13 +29,13 @@ $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallba $exception = $info->arguments()[0]; - $message = V8\Exception::createMessage($info->getContext(), $exception); + $message = V8\ExceptionManager::createMessage($info->getContext(), $exception); $helper->header('Message created from thrown value'); $helper->dump_object_methods($message); $helper->line(); $exception = new \V8\StringValue($info->getIsolate(), 'test'); - $message = V8\Exception::createMessage($info->getContext(), $exception); + $message = V8\ExceptionManager::createMessage($info->getContext(), $exception); $helper->header('Message created from created value'); $helper->dump_object_methods($message); $helper->line(); diff --git a/tests/V8Exception_error.phpt b/tests/ExceptionManager_createError.phpt similarity index 94% rename from tests/V8Exception_error.phpt rename to tests/ExceptionManager_createError.phpt index c979538..9d32bd7 100644 --- a/tests/V8Exception_error.phpt +++ b/tests/ExceptionManager_createError.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::error() +V8\ExceptionManager::createError() --SKIPIF-- --FILE-- @@ -13,7 +13,7 @@ $isolate = new \V8\Isolate(); $context = new \V8\Context($isolate); try { - $error = V8\Exception::error($context, new \V8\StringValue($isolate, 'test')); + $error = V8\ExceptionManager::createError($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can create error when out of context', $error instanceof \V8\Value); } catch (\Exception $e) { $helper->exception_export($e); @@ -24,14 +24,14 @@ $helper->line(); $func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) { $value = count($info->arguments()) ? $info->arguments()[0] : new \V8\StringValue($info->getIsolate(), "exception"); - $info->getIsolate()->throwException($info->getContext(), V8\Exception::error($info->getContext(), $value)); + $info->getIsolate()->throwException($info->getContext(), V8\ExceptionManager::createError($info->getContext(), $value)); }); $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) use ($helper, $v8_helper) { $message = new \V8\StringValue($info->getIsolate(), "test"); - $value1 = V8\Exception::error($info->getContext(), $message); - $value2 = V8\Exception::error($info->getContext(), $message); + $value1 = V8\ExceptionManager::createError($info->getContext(), $message); + $value2 = V8\ExceptionManager::createError($info->getContext(), $message); $context = $info->getContext(); diff --git a/tests/V8Exception_getStackTrace.phpt b/tests/ExceptionManager_createGetStackTrace.phpt similarity index 89% rename from tests/V8Exception_getStackTrace.phpt rename to tests/ExceptionManager_createGetStackTrace.phpt index 6bded6b..19219a2 100644 --- a/tests/V8Exception_getStackTrace.phpt +++ b/tests/ExceptionManager_createGetStackTrace.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::getStackTrace() +V8\ExceptionManager::createGetStackTrace() --SKIPIF-- --FILE-- @@ -14,7 +14,7 @@ $context = new \V8\Context($isolate); try { - $stack_trace = V8\Exception::getStackTrace($context, new \V8\StringValue($isolate, 'test')); + $stack_trace = V8\ExceptionManager::getStackTrace($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can get stack trace when out of context', true); } catch (\Exception $e) { $helper->exception_export($e); @@ -35,21 +35,21 @@ $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallba if (!$stack_trace_generation_allowed) { - $stack_trace = V8\Exception::getStackTrace($info->getContext(), $exception); + $stack_trace = V8\ExceptionManager::getStackTrace($info->getContext(), $exception); $helper->assert('Stack trace created from thrown value is null when capturing stack trace disabled', $stack_trace === null); $helper->line(); return; } - $stack_trace = V8\Exception::getStackTrace($info->getContext(), $exception); + $stack_trace = V8\ExceptionManager::getStackTrace($info->getContext(), $exception); $helper->header('Stack trace created from thrown value'); $helper->dump_object_methods($stack_trace, [], new ArrayListFilter(['getFrame'], true, ReflectionMethod::IS_PUBLIC)); $helper->line(); $exception = new \V8\StringValue($info->getIsolate(), 'test'); - $stack_trace = V8\Exception::getStackTrace($info->getContext(), $exception); + $stack_trace = V8\ExceptionManager::getStackTrace($info->getContext(), $exception); $helper->assert('Stack trace created from manually created value is null', null === $stack_trace); $helper->line(); }); diff --git a/tests/V8Exception_rangeError.phpt b/tests/ExceptionManager_createRangeError.phpt similarity index 93% rename from tests/V8Exception_rangeError.phpt rename to tests/ExceptionManager_createRangeError.phpt index e74ba3e..cbd66c0 100644 --- a/tests/V8Exception_rangeError.phpt +++ b/tests/ExceptionManager_createRangeError.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::rangeError() +V8\ExceptionManager::createRangeError() --SKIPIF-- --FILE-- @@ -14,7 +14,7 @@ $context = new \V8\Context($isolate); try { - $error = V8\Exception::rangeError($context, new \V8\StringValue($isolate, 'test')); + $error = V8\ExceptionManager::createRangeError($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can create error when out of context', $error instanceof \V8\Value); } catch (\Exception $e) { $helper->exception_export($e); @@ -25,14 +25,14 @@ $helper->line(); $func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) { $value = count($info->arguments()) ? $info->arguments()[0] : new \V8\StringValue($info->getIsolate(), "exception"); - $info->getIsolate()->throwException($info->getContext(), V8\Exception::rangeError($info->getContext(), $value)); + $info->getIsolate()->throwException($info->getContext(), V8\ExceptionManager::createRangeError($info->getContext(), $value)); }); $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) use ($helper, $v8_helper) { $message = new \V8\StringValue($info->getIsolate(), "test"); - $value1 = V8\Exception::rangeError($info->getContext(), $message); - $value2 = V8\Exception::rangeError($info->getContext(), $message); + $value1 = V8\ExceptionManager::createRangeError($info->getContext(), $message); + $value2 = V8\ExceptionManager::createRangeError($info->getContext(), $message); $context = $info->getContext(); diff --git a/tests/V8Exception_referenceError.phpt b/tests/ExceptionManager_createReferenceError.phpt similarity index 93% rename from tests/V8Exception_referenceError.phpt rename to tests/ExceptionManager_createReferenceError.phpt index 45662b8..09d87e9 100644 --- a/tests/V8Exception_referenceError.phpt +++ b/tests/ExceptionManager_createReferenceError.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::referenceError() +V8\ExceptionManager::createReferenceError() --SKIPIF-- --FILE-- @@ -14,7 +14,7 @@ $context = new \V8\Context($isolate); try { - $error = V8\Exception::referenceError($context, new \V8\StringValue($isolate, 'test')); + $error = V8\ExceptionManager::createReferenceError($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can create error when out of context', $error instanceof \V8\Value); } catch (\Exception $e) { $helper->exception_export($e); @@ -25,14 +25,14 @@ $helper->line(); $func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) { $value = count($info->arguments()) ? $info->arguments()[0] : new \V8\StringValue($info->getIsolate(), "exception"); - $info->getIsolate()->throwException($info->getContext(), V8\Exception::referenceError($info->getContext(), $value)); + $info->getIsolate()->throwException($info->getContext(), V8\ExceptionManager::createReferenceError($info->getContext(), $value)); }); $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) use ($helper, $v8_helper) { $message = new \V8\StringValue($info->getIsolate(), "test"); - $value1 = V8\Exception::referenceError($info->getContext(), $message); - $value2 = V8\Exception::referenceError($info->getContext(), $message); + $value1 = V8\ExceptionManager::createReferenceError($info->getContext(), $message); + $value2 = V8\ExceptionManager::createReferenceError($info->getContext(), $message); $context = $info->getContext(); diff --git a/tests/V8Exception_syntaxError.phpt b/tests/ExceptionManager_createSyntaxError.phpt similarity index 93% rename from tests/V8Exception_syntaxError.phpt rename to tests/ExceptionManager_createSyntaxError.phpt index bb85f3f..041eeff 100644 --- a/tests/V8Exception_syntaxError.phpt +++ b/tests/ExceptionManager_createSyntaxError.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::syntaxError() +V8\ExceptionManager::createSyntaxError() --SKIPIF-- --FILE-- @@ -14,7 +14,7 @@ $context = new \V8\Context($isolate); try { - $error = V8\Exception::syntaxError($context, new \V8\StringValue($isolate, 'test')); + $error = V8\ExceptionManager::createSyntaxError($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can create error when out of context', $error instanceof \V8\Value); } catch (\Exception $e) { $helper->exception_export($e); @@ -25,14 +25,14 @@ $helper->line(); $func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) { $value = count($info->arguments()) ? $info->arguments()[0] : new \V8\StringValue($info->getIsolate(), "exception"); - $info->getIsolate()->throwException($info->getContext(), V8\Exception::syntaxError($info->getContext(), $value)); + $info->getIsolate()->throwException($info->getContext(), V8\ExceptionManager::createSyntaxError($info->getContext(), $value)); }); $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) use ($helper, $v8_helper) { $message = new \V8\StringValue($info->getIsolate(), "test"); - $value1 = V8\Exception::syntaxError($info->getContext(), $message); - $value2 = V8\Exception::syntaxError($info->getContext(), $message); + $value1 = V8\ExceptionManager::createSyntaxError($info->getContext(), $message); + $value2 = V8\ExceptionManager::createSyntaxError($info->getContext(), $message); $context = $info->getContext(); diff --git a/tests/V8Exception_typeError.phpt b/tests/ExceptionManager_createTypeError.phpt similarity index 93% rename from tests/V8Exception_typeError.phpt rename to tests/ExceptionManager_createTypeError.phpt index b102109..608deac 100644 --- a/tests/V8Exception_typeError.phpt +++ b/tests/ExceptionManager_createTypeError.phpt @@ -1,5 +1,5 @@ --TEST-- -V8\Exception::typeError() +V8\ExceptionManager::createTypeError() --SKIPIF-- --FILE-- @@ -14,7 +14,7 @@ $context = new \V8\Context($isolate); try { - $error = V8\Exception::typeError($context, new \V8\StringValue($isolate, 'test')); + $error = V8\ExceptionManager::createTypeError($context, new \V8\StringValue($isolate, 'test')); $helper->assert('Can create error when out of context', $error instanceof \V8\Value); } catch (\Exception $e) { $helper->exception_export($e); @@ -25,14 +25,14 @@ $helper->line(); $func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) { $value = count($info->arguments()) ? $info->arguments()[0] : new \V8\StringValue($info->getIsolate(), "exception"); - $info->getIsolate()->throwException($info->getContext(), V8\Exception::typeError($info->getContext(), $value)); + $info->getIsolate()->throwException($info->getContext(), V8\ExceptionManager::createTypeError($info->getContext(), $value)); }); $func_test_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInfo $info) use ($helper, $v8_helper) { $message = new \V8\StringValue($info->getIsolate(), "test"); - $value1 = V8\Exception::typeError($info->getContext(), $message); - $value2 = V8\Exception::typeError($info->getContext(), $message); + $value1 = V8\ExceptionManager::createTypeError($info->getContext(), $message); + $value2 = V8\ExceptionManager::createTypeError($info->getContext(), $message); $context = $info->getContext(); diff --git a/tests/V8ExceptionsTryCatchException.phpt b/tests/ExceptionsTryCatchException.phpt similarity index 97% rename from tests/V8ExceptionsTryCatchException.phpt rename to tests/ExceptionsTryCatchException.phpt index 5531dd0..df1e2b4 100644 --- a/tests/V8ExceptionsTryCatchException.phpt +++ b/tests/ExceptionsTryCatchException.phpt @@ -40,7 +40,7 @@ object(V8\Exceptions\TryCatchException)#5 (10) { ["code":protected]=> int(0) ["file":protected]=> - string(%d) "%s/V8ExceptionsTryCatchException.php" + string(%d) "%s/ExceptionsTryCatchException.php" ["line":protected]=> int(11) ["trace":"Exception":private]=> diff --git a/tests/V8FunctionCallbackInfo.phpt b/tests/FunctionCallbackInfo.phpt similarity index 100% rename from tests/V8FunctionCallbackInfo.phpt rename to tests/FunctionCallbackInfo.phpt diff --git a/tests/V8FunctionObject.phpt b/tests/FunctionObject.phpt similarity index 89% rename from tests/V8FunctionObject.phpt rename to tests/FunctionObject.phpt index 482ebf9..e34949f 100644 --- a/tests/V8FunctionObject.phpt +++ b/tests/FunctionObject.phpt @@ -15,9 +15,9 @@ $v8_helper = new PhpV8Helpers($helper); require '.tracking_dtors.php'; -$isolate = new v8Tests\TrackingDtors\Isolate(); +$isolate = new v8Tests\TrackingDtors\Isolate(); $global_template = new V8\ObjectTemplate($isolate); -$context = new V8\Context($isolate, $global_template); +$context = new V8\Context($isolate, $global_template); $func = new v8Tests\TrackingDtors\FunctionObject($context, function (\V8\FunctionCallbackInfo $info) { @@ -33,24 +33,32 @@ $helper->space(); $helper->assert('FunctionObject extends ObjectValue', $func instanceof \V8\ObjectValue); $helper->assert('FunctionObject implements AdjustableExternalMemoryInterface', $func instanceof \V8\AdjustableExternalMemoryInterface); $helper->assert('FunctionObject is instanceof Function', $func->instanceOf($context, $context->globalObject()->get($context, new \V8\StringValue($isolate, 'Function')))); +$helper->assert('Function created from php holds no script id', $func->getScriptId() === null); $helper->line(); $v8_helper->run_checks($func, 'Checkers'); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'print'), $func); -$source = 'print("Hello, world"); delete print; "Script done"'; +$source = 'print("Hello, world"); delete print; "Script done"'; $file_name = 'test.js'; $script = new V8\Script($context, new \V8\StringValue($isolate, $source), new \V8\ScriptOrigin($file_name)); $helper->dump($script->run($context)->toString($context)->value()); + +$helper->assert('Function created from php still holds no script id after been passed to script', $func->getScriptId() === null); + $helper->line(); $helper->dump_object_methods($func, [], new ArrayMapFilter(['getScriptOrigin' => true])); $helper->line(); +$helper->line(); +$fnc2 = $v8_helper->CompileRun($context, 'function test() {}; test'); +$helper->assert('Function from script holds script id', $fnc2->getScriptId() !== null); + echo 'We are done for now', PHP_EOL; ?> @@ -73,6 +81,7 @@ object(v8Tests\TrackingDtors\FunctionObject)#6 (2) { FunctionObject extends ObjectValue: ok FunctionObject implements AdjustableExternalMemoryInterface: ok FunctionObject is instanceof Function: ok +Function created from php holds no script id: ok Checkers: --------- @@ -132,9 +141,10 @@ v8Tests\TrackingDtors\FunctionObject(V8\Value)->isProxy(): bool(false) Should output Hello World string string(11) "Script done" +Function created from php still holds no script id after been passed to script: ok v8Tests\TrackingDtors\FunctionObject(V8\FunctionObject)->getScriptOrigin(): - object(V8\ScriptOrigin)#128 (6) { + object(V8\ScriptOrigin)#129 (6) { ["resource_name":"V8\ScriptOrigin":private]=> string(0) "" ["resource_line_offset":"V8\ScriptOrigin":private]=> @@ -142,7 +152,7 @@ v8Tests\TrackingDtors\FunctionObject(V8\FunctionObject)->getScriptOrigin(): ["resource_column_offset":"V8\ScriptOrigin":private]=> int(0) ["options":"V8\ScriptOrigin":private]=> - object(V8\ScriptOriginOptions)#132 (4) { + object(V8\ScriptOriginOptions)#133 (4) { ["is_shared_cross_origin":"V8\ScriptOriginOptions":private]=> bool(false) ["is_opaque":"V8\ScriptOriginOptions":private]=> @@ -158,6 +168,8 @@ v8Tests\TrackingDtors\FunctionObject(V8\FunctionObject)->getScriptOrigin(): string(0) "" } + +Function from script holds script id: ok We are done for now FunctionObject dies now! Isolate dies now! diff --git a/tests/V8FunctionObject_call.phpt b/tests/FunctionObject_call.phpt similarity index 100% rename from tests/V8FunctionObject_call.phpt rename to tests/FunctionObject_call.phpt diff --git a/tests/V8FunctionObject_call_bad_args.phpt b/tests/FunctionObject_call_bad_args.phpt similarity index 100% rename from tests/V8FunctionObject_call_bad_args.phpt rename to tests/FunctionObject_call_bad_args.phpt diff --git a/tests/V8FunctionObject_constructor_behavior.phpt b/tests/FunctionObject_constructor_behavior.phpt similarity index 96% rename from tests/V8FunctionObject_constructor_behavior.phpt rename to tests/FunctionObject_constructor_behavior.phpt index 52eb8c9..21fd324 100644 --- a/tests/V8FunctionObject_constructor_behavior.phpt +++ b/tests/FunctionObject_constructor_behavior.phpt @@ -25,7 +25,7 @@ $f_allow = new \V8\FunctionObject($context, function () { $f_throw = new \V8\FunctionObject($context, function () { echo 'Throw', PHP_EOL; -}, 0, \V8\ConstructorBehavior::kThrow); +}, 0, \V8\ConstructorBehavior::THROW); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'f_allow'), $f_allow); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'f_throw'), $f_throw); diff --git a/tests/V8FunctionObject_die.phpt b/tests/FunctionObject_die.phpt similarity index 100% rename from tests/V8FunctionObject_die.phpt rename to tests/FunctionObject_die.phpt diff --git a/tests/V8FunctionObject_die_different_isolates.phpt b/tests/FunctionObject_die_different_isolates.phpt similarity index 100% rename from tests/V8FunctionObject_die_different_isolates.phpt rename to tests/FunctionObject_die_different_isolates.phpt diff --git a/tests/V8FunctionObject_die_nested.phpt b/tests/FunctionObject_die_nested.phpt similarity index 100% rename from tests/V8FunctionObject_die_nested.phpt rename to tests/FunctionObject_die_nested.phpt diff --git a/tests/V8FunctionObject_newInstance.phpt b/tests/FunctionObject_newInstance.phpt similarity index 100% rename from tests/V8FunctionObject_newInstance.phpt rename to tests/FunctionObject_newInstance.phpt diff --git a/tests/V8FunctionObject_weakness_multiple.phpt b/tests/FunctionObject_weakness_multiple.phpt similarity index 100% rename from tests/V8FunctionObject_weakness_multiple.phpt rename to tests/FunctionObject_weakness_multiple.phpt diff --git a/tests/V8FunctionTemplate.phpt b/tests/FunctionTemplate.phpt similarity index 98% rename from tests/V8FunctionTemplate.phpt rename to tests/FunctionTemplate.phpt index d15fa7f..fb2aa80 100644 --- a/tests/V8FunctionTemplate.phpt +++ b/tests/FunctionTemplate.phpt @@ -79,7 +79,7 @@ $value = new V8\StringValue($isolate, 'TEST VALUE 111'); $global_template->set(new \V8\StringValue($isolate, 'test'), $value); $global_template->set(new \V8\StringValue($isolate, 'func'), $function_template); -$global_template->set(new \V8\StringValue($isolate, 'print'), $print_func_tpl, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'print'), $print_func_tpl, \V8\PropertyAttribute::DONT_DELETE); $context = new V8\Context($isolate, $global_template); diff --git a/tests/V8FunctionTemplate_callback_weakness.phpt b/tests/FunctionTemplate_callback_weakness.phpt similarity index 100% rename from tests/V8FunctionTemplate_callback_weakness.phpt rename to tests/FunctionTemplate_callback_weakness.phpt diff --git a/tests/V8FunctionTemplate_constructor_behavior.phpt b/tests/FunctionTemplate_constructor_behavior.phpt similarity index 96% rename from tests/V8FunctionTemplate_constructor_behavior.phpt rename to tests/FunctionTemplate_constructor_behavior.phpt index 2284896..5e814c5 100644 --- a/tests/V8FunctionTemplate_constructor_behavior.phpt +++ b/tests/FunctionTemplate_constructor_behavior.phpt @@ -25,7 +25,7 @@ $ftpl_allow = new \V8\FunctionTemplate($isolate, function () { $ftpl_throw = new \V8\FunctionTemplate($isolate, function () { echo 'Throw', PHP_EOL; -}, null, 0, \V8\ConstructorBehavior::kThrow); +}, null, 0, \V8\ConstructorBehavior::THROW); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'f_allow'), $ftpl_allow->getFunction($context)); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'f_throw'), $ftpl_throw->getFunction($context)); diff --git a/tests/V8FunctionTemplate_constructor_receiver.phpt b/tests/FunctionTemplate_constructor_receiver.phpt similarity index 100% rename from tests/V8FunctionTemplate_constructor_receiver.phpt rename to tests/FunctionTemplate_constructor_receiver.phpt diff --git a/tests/V8FunctionTemplate_exception_in_php.phpt b/tests/FunctionTemplate_exception_in_php.phpt similarity index 95% rename from tests/V8FunctionTemplate_exception_in_php.phpt rename to tests/FunctionTemplate_exception_in_php.phpt index 1c03ee1..8c57b65 100644 --- a/tests/V8FunctionTemplate_exception_in_php.phpt +++ b/tests/FunctionTemplate_exception_in_php.phpt @@ -18,7 +18,7 @@ $test_func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallba $global_template = new V8\ObjectTemplate($isolate); -$global_template->set(new \V8\StringValue($isolate, 'test'), $test_func_tpl, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'test'), $test_func_tpl, \V8\PropertyAttribute::DONT_DELETE); $context = new V8\Context($isolate, $global_template); diff --git a/tests/V8FunctionTemplate_getFunction.phpt b/tests/FunctionTemplate_getFunction.phpt similarity index 100% rename from tests/V8FunctionTemplate_getFunction.phpt rename to tests/FunctionTemplate_getFunction.phpt diff --git a/tests/V8FunctionTemplate_invalid_ctor_arg_type.phpt b/tests/FunctionTemplate_invalid_ctor_arg_type.phpt similarity index 100% rename from tests/V8FunctionTemplate_invalid_ctor_arg_type.phpt rename to tests/FunctionTemplate_invalid_ctor_arg_type.phpt diff --git a/tests/V8FunctionTemplate_require_implementation.phpt b/tests/FunctionTemplate_require_implementation.phpt similarity index 96% rename from tests/V8FunctionTemplate_require_implementation.phpt rename to tests/FunctionTemplate_require_implementation.phpt index e6f54cc..f065fd7 100644 --- a/tests/V8FunctionTemplate_require_implementation.phpt +++ b/tests/FunctionTemplate_require_implementation.phpt @@ -40,7 +40,7 @@ $require_func_tpl_cache = new \V8\FunctionTemplate($isolate, function (\V8\Funct $info->getReturnValue()->set($loaded_cache[$module]); }); $global_template = new V8\ObjectTemplate($isolate); -$global_template->set(new \V8\StringValue($isolate, 'require'), $require_func_tpl_cache, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'require'), $require_func_tpl_cache, \V8\PropertyAttribute::DONT_DELETE); $context = new V8\Context($isolate, $global_template); $v8_helper->injectConsoleLog($context); @@ -90,7 +90,7 @@ $require_func_tpl_nocache = new \V8\FunctionTemplate($isolate, function (\V8\Fun $global_template = new V8\ObjectTemplate($isolate); -$global_template->set(new \V8\StringValue($isolate, 'require'), $require_func_tpl_nocache, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'require'), $require_func_tpl_nocache, \V8\PropertyAttribute::DONT_DELETE); $context = new V8\Context($isolate, $global_template); $v8_helper->injectConsoleLog($context); diff --git a/tests/V8FunctionTemplate_set.phpt b/tests/FunctionTemplate_set.phpt similarity index 100% rename from tests/V8FunctionTemplate_set.phpt rename to tests/FunctionTemplate_set.phpt diff --git a/tests/V8FunctionTemplate_setCallHandler.phpt b/tests/FunctionTemplate_setCallHandler.phpt similarity index 100% rename from tests/V8FunctionTemplate_setCallHandler.phpt rename to tests/FunctionTemplate_setCallHandler.phpt diff --git a/tests/V8FunctionTemplate_weakness.phpt b/tests/FunctionTemplate_weakness.phpt similarity index 100% rename from tests/V8FunctionTemplate_weakness.phpt rename to tests/FunctionTemplate_weakness.phpt diff --git a/tests/V8HeapStatistics.phpt b/tests/HeapStatistics.phpt similarity index 69% rename from tests/V8HeapStatistics.phpt rename to tests/HeapStatistics.phpt index 474ad07..035d1ca 100644 --- a/tests/V8HeapStatistics.phpt +++ b/tests/HeapStatistics.phpt @@ -41,12 +41,12 @@ object(V8\HeapStatistics)#2 (9) { bool(true) } -V8\HeapStatistics->total_heap_size(): float(1) -V8\HeapStatistics->total_heap_size_executable(): float(2) -V8\HeapStatistics->total_physical_size(): float(3) -V8\HeapStatistics->total_available_size(): float(4) -V8\HeapStatistics->used_heap_size(): float(5) -V8\HeapStatistics->heap_size_limit(): float(6) -V8\HeapStatistics->malloced_memory(): float(7) -V8\HeapStatistics->peak_malloced_memory(): float(8) -V8\HeapStatistics->does_zap_garbage(): bool(true) +V8\HeapStatistics->getTotalHeapSize(): float(1) +V8\HeapStatistics->getTotalHeapSizeExecutable(): float(2) +V8\HeapStatistics->getTotalPhysicalSize(): float(3) +V8\HeapStatistics->getTotalAvailableSize(): float(4) +V8\HeapStatistics->getUsedHeapSize(): float(5) +V8\HeapStatistics->getHeapSizeLimit(): float(6) +V8\HeapStatistics->getMallocedMemory(): float(7) +V8\HeapStatistics->getPeakMallocedMemory(): float(8) +V8\HeapStatistics->doesZapGarbage(): bool(true) diff --git a/tests/V8IndexedPropertyHandlerConfiguration.phpt b/tests/IndexedPropertyHandlerConfiguration.phpt similarity index 100% rename from tests/V8IndexedPropertyHandlerConfiguration.phpt rename to tests/IndexedPropertyHandlerConfiguration.phpt diff --git a/tests/V8Int32Value.phpt b/tests/Int32Value.phpt similarity index 100% rename from tests/V8Int32Value.phpt rename to tests/Int32Value.phpt diff --git a/tests/V8IntegerValue.phpt b/tests/IntegerValue.phpt similarity index 100% rename from tests/V8IntegerValue.phpt rename to tests/IntegerValue.phpt diff --git a/tests/V8Isolate.phpt b/tests/Isolate.phpt similarity index 100% rename from tests/V8Isolate.phpt rename to tests/Isolate.phpt diff --git a/tests/V8Isolate_gc_cyclic_ref_memleak.phpt b/tests/Isolate_gc_cyclic_ref_memleak.phpt similarity index 96% rename from tests/V8Isolate_gc_cyclic_ref_memleak.phpt rename to tests/Isolate_gc_cyclic_ref_memleak.phpt index 7ef9621..35937c5 100644 --- a/tests/V8Isolate_gc_cyclic_ref_memleak.phpt +++ b/tests/Isolate_gc_cyclic_ref_memleak.phpt @@ -17,7 +17,7 @@ $isolate = new \V8\Isolate(); $global_template = new V8\ObjectTemplate($isolate); $func_tpl = new \V8\FunctionTemplate($isolate, function () {}); -$global_template->set(new \V8\StringValue($isolate, 'func'), $func_tpl, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'func'), $func_tpl, \V8\PropertyAttribute::DONT_DELETE); $foo = new V8\ObjectTemplate($isolate);; $name = new V8\StringValue($isolate, 'test'); diff --git a/tests/V8Isolate_getEnteredContext.phpt b/tests/Isolate_getEnteredContext.phpt similarity index 100% rename from tests/V8Isolate_getEnteredContext.phpt rename to tests/Isolate_getEnteredContext.phpt diff --git a/tests/V8Isolate_isDead.phpt b/tests/Isolate_isDead.phpt similarity index 100% rename from tests/V8Isolate_isDead.phpt rename to tests/Isolate_isDead.phpt diff --git a/tests/V8Isolate_isInUse.phpt b/tests/Isolate_isInUse.phpt similarity index 100% rename from tests/V8Isolate_isInUse.phpt rename to tests/Isolate_isInUse.phpt diff --git a/tests/V8Isolate_limit_memory.phpt b/tests/Isolate_limit_memory.phpt similarity index 100% rename from tests/V8Isolate_limit_memory.phpt rename to tests/Isolate_limit_memory.phpt diff --git a/tests/V8Isolate_limit_memory_nested.phpt b/tests/Isolate_limit_memory_nested.phpt similarity index 100% rename from tests/V8Isolate_limit_memory_nested.phpt rename to tests/Isolate_limit_memory_nested.phpt diff --git a/tests/V8Isolate_limit_memory_not_hit.phpt b/tests/Isolate_limit_memory_not_hit.phpt similarity index 100% rename from tests/V8Isolate_limit_memory_not_hit.phpt rename to tests/Isolate_limit_memory_not_hit.phpt diff --git a/tests/V8Isolate_limit_time.phpt b/tests/Isolate_limit_time.phpt similarity index 100% rename from tests/V8Isolate_limit_time.phpt rename to tests/Isolate_limit_time.phpt diff --git a/tests/V8Isolate_limit_time_affects_js_runtime_only.phpt b/tests/Isolate_limit_time_affects_js_runtime_only.phpt similarity index 100% rename from tests/V8Isolate_limit_time_affects_js_runtime_only.phpt rename to tests/Isolate_limit_time_affects_js_runtime_only.phpt diff --git a/tests/V8Isolate_limit_time_changed_at_runtime.phpt b/tests/Isolate_limit_time_changed_at_runtime.phpt similarity index 100% rename from tests/V8Isolate_limit_time_changed_at_runtime.phpt rename to tests/Isolate_limit_time_changed_at_runtime.phpt diff --git a/tests/V8Isolate_limit_time_nested.phpt b/tests/Isolate_limit_time_nested.phpt similarity index 100% rename from tests/V8Isolate_limit_time_nested.phpt rename to tests/Isolate_limit_time_nested.phpt diff --git a/tests/V8Isolate_limit_time_not_hit.phpt b/tests/Isolate_limit_time_not_hit.phpt similarity index 100% rename from tests/V8Isolate_limit_time_not_hit.phpt rename to tests/Isolate_limit_time_not_hit.phpt diff --git a/tests/V8Isolate_limit_time_set_during_execution.phpt b/tests/Isolate_limit_time_set_during_execution.phpt similarity index 100% rename from tests/V8Isolate_limit_time_set_during_execution.phpt rename to tests/Isolate_limit_time_set_during_execution.phpt diff --git a/tests/V8Isolate_nested_termination_exceptions.phpt b/tests/Isolate_nested_termination_exceptions.phpt similarity index 100% rename from tests/V8Isolate_nested_termination_exceptions.phpt rename to tests/Isolate_nested_termination_exceptions.phpt diff --git a/tests/V8Isolate_snapshot_support.phpt b/tests/Isolate_snapshot_support.phpt similarity index 100% rename from tests/V8Isolate_snapshot_support.phpt rename to tests/Isolate_snapshot_support.phpt diff --git a/tests/V8Isolate_throwException.phpt b/tests/Isolate_throwException.phpt similarity index 100% rename from tests/V8Isolate_throwException.phpt rename to tests/Isolate_throwException.phpt diff --git a/tests/V8Isolate_throwException_with_external.phpt b/tests/Isolate_throwException_with_external.phpt similarity index 92% rename from tests/V8Isolate_throwException_with_external.phpt rename to tests/Isolate_throwException_with_external.phpt index 3f19355..977b643 100644 --- a/tests/V8Isolate_throwException_with_external.phpt +++ b/tests/Isolate_throwException_with_external.phpt @@ -25,7 +25,7 @@ try { } -$v8_exception = \V8\Exception::error($context, new \V8\StringValue($isolate, 'test')); +$v8_exception = \V8\ExceptionManager::createError($context, new \V8\StringValue($isolate, 'test')); $func_tpl = new \V8\FunctionObject($context, function (\V8\FunctionCallbackInfo $info) use (&$v8_exception) { $info->getIsolate()->throwException($info->getContext(), $v8_exception, new RuntimeException('test')); @@ -54,7 +54,7 @@ try { $helper->exception_export($e); } -$v8_exception = \V8\Exception::error($context, new \V8\StringValue($isolate, 'test')); +$v8_exception = \V8\ExceptionManager::createError($context, new \V8\StringValue($isolate, 'test')); // re-throw the same v8 object after it was propagated through TryCatch mechanism is OK diff --git a/tests/V8MapObject.phpt b/tests/MapObject.phpt similarity index 100% rename from tests/V8MapObject.phpt rename to tests/MapObject.phpt diff --git a/tests/V8Message.phpt b/tests/Message.phpt similarity index 100% rename from tests/V8Message.phpt rename to tests/Message.phpt diff --git a/tests/V8NamedPropertyHandlerConfiguration.phpt b/tests/NamedPropertyHandlerConfiguration.phpt similarity index 100% rename from tests/V8NamedPropertyHandlerConfiguration.phpt rename to tests/NamedPropertyHandlerConfiguration.phpt diff --git a/tests/V8NullValue.phpt b/tests/NullValue.phpt similarity index 100% rename from tests/V8NullValue.phpt rename to tests/NullValue.phpt diff --git a/tests/V8NumberObject.phpt b/tests/NumberObject.phpt similarity index 100% rename from tests/V8NumberObject.phpt rename to tests/NumberObject.phpt diff --git a/tests/V8NumberValue.phpt b/tests/NumberValue.phpt similarity index 100% rename from tests/V8NumberValue.phpt rename to tests/NumberValue.phpt diff --git a/tests/V8ObjectTemplate.phpt b/tests/ObjectTemplate.phpt similarity index 100% rename from tests/V8ObjectTemplate.phpt rename to tests/ObjectTemplate.phpt diff --git a/tests/V8ObjectTemplate_invalid_ctor_arg_type.phpt b/tests/ObjectTemplate_invalid_ctor_arg_type.phpt similarity index 100% rename from tests/V8ObjectTemplate_invalid_ctor_arg_type.phpt rename to tests/ObjectTemplate_invalid_ctor_arg_type.phpt diff --git a/tests/V8ObjectTemplate_set.phpt b/tests/ObjectTemplate_set.phpt similarity index 100% rename from tests/V8ObjectTemplate_set.phpt rename to tests/ObjectTemplate_set.phpt diff --git a/tests/V8ObjectTemplate_setAccessor_receiver.phpt b/tests/ObjectTemplate_setAccessor_receiver.phpt similarity index 99% rename from tests/V8ObjectTemplate_setAccessor_receiver.phpt rename to tests/ObjectTemplate_setAccessor_receiver.phpt index 1cee83b..7b18861 100644 --- a/tests/V8ObjectTemplate_setAccessor_receiver.phpt +++ b/tests/ObjectTemplate_setAccessor_receiver.phpt @@ -33,7 +33,7 @@ $setter = function (\V8\NameValue $prop, \V8\Value $value, \V8\PropertyCallbackI $templ = new \V8\FunctionTemplate($isolate); $inst = $templ->instanceTemplate(); -$inst->setAccessor(new \V8\StringValue($isolate, 'foo'), $getter, $setter, \V8\AccessControl::DEFAULT_ACCESS, \V8\PropertyAttribute::None, $templ); +$inst->setAccessor(new \V8\StringValue($isolate, 'foo'), $getter, $setter, \V8\AccessControl::DEFAULT_ACCESS, \V8\PropertyAttribute::NONE, $templ); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'f'), $templ->getFunction($context)); diff --git a/tests/V8ObjectTemplate_setCallAsFunctionHandler.phpt b/tests/ObjectTemplate_setCallAsFunctionHandler.phpt similarity index 100% rename from tests/V8ObjectTemplate_setCallAsFunctionHandler.phpt rename to tests/ObjectTemplate_setCallAsFunctionHandler.phpt diff --git a/tests/V8ObjectTemplate_setHandlerForIndexedProperty.phpt b/tests/ObjectTemplate_setHandlerForIndexedProperty.phpt similarity index 99% rename from tests/V8ObjectTemplate_setHandlerForIndexedProperty.phpt rename to tests/ObjectTemplate_setHandlerForIndexedProperty.phpt index c8ade7c..a27ac2e 100644 --- a/tests/V8ObjectTemplate_setHandlerForIndexedProperty.phpt +++ b/tests/ObjectTemplate_setHandlerForIndexedProperty.phpt @@ -40,7 +40,7 @@ $query = function ($index, \V8\PropertyCallbackInfo $info) use (&$foo) { return; } - $info->getReturnValue()->setInteger(\V8\PropertyAttribute::None); + $info->getReturnValue()->setInteger(\V8\PropertyAttribute::NONE); }; $deleter = function (int $index, \V8\PropertyCallbackInfo $info) use (&$foo) { diff --git a/tests/V8ObjectTemplate_setHandlerForNamedProperty.phpt b/tests/ObjectTemplate_setHandlerForNamedProperty.phpt similarity index 99% rename from tests/V8ObjectTemplate_setHandlerForNamedProperty.phpt rename to tests/ObjectTemplate_setHandlerForNamedProperty.phpt index 9755245..7d0836f 100644 --- a/tests/V8ObjectTemplate_setHandlerForNamedProperty.phpt +++ b/tests/ObjectTemplate_setHandlerForNamedProperty.phpt @@ -35,7 +35,7 @@ $setter = function (\V8\NameValue $name, \V8\Value $value, \V8\PropertyCallbackI $query = function (\V8\NameValue$name, \V8\PropertyCallbackInfo $info) use (&$foo) { echo 'I am named query for ', $name->toString($info->getContext())->value(), '!', PHP_EOL; - $info->getReturnValue()->setInteger(\V8\PropertyAttribute::None); + $info->getReturnValue()->setInteger(\V8\PropertyAttribute::NONE); }; $deleter = function (\V8\NameValue$name, \V8\PropertyCallbackInfo $info) use (&$foo) { diff --git a/tests/V8ObjectTemplate_setHandler_both.phpt b/tests/ObjectTemplate_setHandler_both.phpt similarity index 99% rename from tests/V8ObjectTemplate_setHandler_both.phpt rename to tests/ObjectTemplate_setHandler_both.phpt index 23ca515..1883b85 100644 --- a/tests/V8ObjectTemplate_setHandler_both.phpt +++ b/tests/ObjectTemplate_setHandler_both.phpt @@ -38,7 +38,7 @@ $setter = function (\V8\NameValue$name, \V8\Value $value, \V8\PropertyCallbackIn $query = function (\V8\NameValue$name, \V8\PropertyCallbackInfo $info) use (&$foo) { echo 'I am named query for ', $name->toString($info->getContext())->value(), '!', PHP_EOL; - $info->getReturnValue()->setInteger(\V8\PropertyAttribute::None); + $info->getReturnValue()->setInteger(\V8\PropertyAttribute::NONE); }; $deleter = function (\V8\NameValue$name, \V8\PropertyCallbackInfo $info) use (&$foo) { @@ -90,7 +90,7 @@ $query = function ($index, \V8\PropertyCallbackInfo $info) use (&$foo) { return; } - $info->getReturnValue()->setInteger(\V8\PropertyAttribute::None); + $info->getReturnValue()->setInteger(\V8\PropertyAttribute::NONE); }; $deleter = function (int $index, \V8\PropertyCallbackInfo $info) use (&$foo) { diff --git a/tests/V8ObjectTemplate_setNativeDataProperty.phpt b/tests/ObjectTemplate_setNativeDataProperty.phpt similarity index 100% rename from tests/V8ObjectTemplate_setNativeDataProperty.phpt rename to tests/ObjectTemplate_setNativeDataProperty.phpt diff --git a/tests/V8ObjectValue.phpt b/tests/ObjectValue.phpt similarity index 100% rename from tests/V8ObjectValue.phpt rename to tests/ObjectValue.phpt diff --git a/tests/V8ObjectValue_get.phpt b/tests/ObjectValue_get.phpt similarity index 100% rename from tests/V8ObjectValue_get.phpt rename to tests/ObjectValue_get.phpt diff --git a/tests/V8ObjectValue_isArgumentsObject.phpt b/tests/ObjectValue_isArgumentsObject.phpt similarity index 100% rename from tests/V8ObjectValue_isArgumentsObject.phpt rename to tests/ObjectValue_isArgumentsObject.phpt diff --git a/tests/V8ObjectValue_isNativeError.phpt b/tests/ObjectValue_isNativeError.phpt similarity index 100% rename from tests/V8ObjectValue_isNativeError.phpt rename to tests/ObjectValue_isNativeError.phpt diff --git a/tests/V8ObjectValue_setAccessor.phpt b/tests/ObjectValue_setAccessor.phpt similarity index 98% rename from tests/V8ObjectValue_setAccessor.phpt rename to tests/ObjectValue_setAccessor.phpt index 30105a4..c67b2bf 100644 --- a/tests/V8ObjectValue_setAccessor.phpt +++ b/tests/ObjectValue_setAccessor.phpt @@ -38,7 +38,7 @@ $print_func_tpl = new \V8\FunctionTemplate($isolate, function (\V8\FunctionCallb echo implode('', $out), PHP_EOL; }); -$global_template->set(new \V8\StringValue($isolate, 'print'), $print_func_tpl, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'print'), $print_func_tpl, \V8\PropertyAttribute::DONT_DELETE); $context = new V8\Context($isolate, $global_template); diff --git a/tests/V8ObjectValue_setIntegrityLevel.phpt b/tests/ObjectValue_setIntegrityLevel.phpt similarity index 94% rename from tests/V8ObjectValue_setIntegrityLevel.phpt rename to tests/ObjectValue_setIntegrityLevel.phpt index 3c81379..390d25b 100644 --- a/tests/V8ObjectValue_setIntegrityLevel.phpt +++ b/tests/ObjectValue_setIntegrityLevel.phpt @@ -24,12 +24,12 @@ $context->globalObject()->set($context, new \V8\StringValue($isolate, 'obj0'), $ $obj1 = new \V8\ObjectValue($context); $obj1->set($context, new \V8\StringValue($isolate, 'test'), new \V8\IntegerValue($isolate, 42)); -$obj1->setIntegrityLevel($context, \V8\IntegrityLevel::kFrozen); +$obj1->setIntegrityLevel($context, \V8\IntegrityLevel::FROZEN); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'obj1'), $obj1); $obj2 = new \V8\ObjectValue($context); $obj2->set($context, new \V8\StringValue($isolate, 'test'), new \V8\IntegerValue($isolate, 42)); -$obj2->setIntegrityLevel($context, \V8\IntegrityLevel::kSealed); +$obj2->setIntegrityLevel($context, \V8\IntegrityLevel::SEALED); $context->globalObject()->set($context, new \V8\StringValue($isolate, 'obj2'), $obj2); $source = ' diff --git a/tests/V8ObjectValue_setNativeDataProperty.phpt b/tests/ObjectValue_setNativeDataProperty.phpt similarity index 100% rename from tests/V8ObjectValue_setNativeDataProperty.phpt rename to tests/ObjectValue_setNativeDataProperty.phpt diff --git a/tests/V8ObjectValue_setNativeDataProperty_from_template.phpt b/tests/ObjectValue_setNativeDataProperty_from_template.phpt similarity index 100% rename from tests/V8ObjectValue_setNativeDataProperty_from_template.phpt rename to tests/ObjectValue_setNativeDataProperty_from_template.phpt diff --git a/tests/V8PropertyCallbackInfo.phpt b/tests/PropertyCallbackInfo.phpt similarity index 100% rename from tests/V8PropertyCallbackInfo.phpt rename to tests/PropertyCallbackInfo.phpt diff --git a/tests/V8RegExpObject.phpt b/tests/RegExpObject.phpt similarity index 98% rename from tests/V8RegExpObject.phpt rename to tests/RegExpObject.phpt index be95a9e..e8d4c4c 100644 --- a/tests/V8RegExpObject.phpt +++ b/tests/RegExpObject.phpt @@ -17,7 +17,7 @@ $isolate = new \V8\Isolate(); $context = new V8\Context($isolate); $v8_helper->injectConsoleLog($context); -$value = new V8\RegExpObject($context, new \V8\StringValue($isolate, '([a-z]{1,4})-([0-9]+)'), \V8\RegExpObject\Flags::kIgnoreCase); +$value = new V8\RegExpObject($context, new \V8\StringValue($isolate, '([a-z]{1,4})-([0-9]+)'), \V8\RegExpObject\Flags::IGNORE_CASE); $helper->header('Object representation'); $helper->dump($value); diff --git a/tests/V8ReturnValue.phpt b/tests/ReturnValue.phpt similarity index 100% rename from tests/V8ReturnValue.phpt rename to tests/ReturnValue.phpt diff --git a/tests/V8ReturnValue_context.phpt b/tests/ReturnValue_context.phpt similarity index 100% rename from tests/V8ReturnValue_context.phpt rename to tests/ReturnValue_context.phpt diff --git a/tests/V8Script.phpt b/tests/Script.phpt similarity index 100% rename from tests/V8Script.phpt rename to tests/Script.phpt diff --git a/tests/V8ScriptCompiler.phpt b/tests/ScriptCompiler.phpt similarity index 100% rename from tests/V8ScriptCompiler.phpt rename to tests/ScriptCompiler.phpt diff --git a/tests/V8ScriptCompiler_compile.phpt b/tests/ScriptCompiler_compile.phpt similarity index 94% rename from tests/V8ScriptCompiler_compile.phpt rename to tests/ScriptCompiler_compile.phpt index 562a5d9..c8e7ded 100644 --- a/tests/V8ScriptCompiler_compile.phpt +++ b/tests/ScriptCompiler_compile.phpt @@ -71,7 +71,7 @@ $cache_data = null; $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is not set', $source->getCachedData() === null); try { - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); } catch (\V8\Exceptions\Exception $e) { $helper->exception_export($e); } @@ -82,7 +82,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status'); $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kProduceCodeCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE); $helper->assert('Source cache data is update', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -95,7 +95,7 @@ $cache_data = null; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -107,7 +107,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"other " + status'); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); @@ -119,7 +119,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, ' "test " + status'); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false); @@ -131,7 +131,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status'); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kProduceCodeCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); @@ -144,7 +144,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status'); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true); @@ -157,7 +157,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status'); $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kProduceParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE); $helper->assert('Source cache data is NOT updated', $source->getCachedData() === null); $helper->line(); @@ -177,7 +177,7 @@ $parser_cache_src= 'function test(arg1, args) { $source_string = new V8\StringValue($isolate, $parser_cache_src); $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kProduceParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE); $helper->assert('Source cache data is update', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -193,7 +193,7 @@ $parser_cache_src= 'function test(arg1, args) { $source_string = new V8\StringValue($isolate, $parser_cache_src); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -208,7 +208,7 @@ $parser_cache_src= 'function test(arg1, args) { $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); try { - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); } catch (\V8\Exceptions\TryCatchException $e) { $helper->exception_export($e); } @@ -223,7 +223,7 @@ $parser_cache_src= 'function test(arg1, args) { $source_string = new V8\StringValue($isolate, 'function test2() { return 1+1;}'); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); $helper->assert('Source cache data is not changed', $source->getCachedData()->getData() === $bin); @@ -237,7 +237,7 @@ $parser_cache_src= 'function test(arg1, args) { $source_string = new V8\StringValue($isolate, ' ' . $parser_cache_src); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); @@ -250,7 +250,7 @@ $parser_cache_src= 'function test(arg1, args) { $source_string = new V8\StringValue($isolate, $parser_cache_src); $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); diff --git a/tests/V8ScriptCompiler_compileFunctionInContext.phpt b/tests/ScriptCompiler_compileFunctionInContext.phpt similarity index 100% rename from tests/V8ScriptCompiler_compileFunctionInContext.phpt rename to tests/ScriptCompiler_compileFunctionInContext.phpt diff --git a/tests/V8ScriptCompiler_compileUnbound.phpt b/tests/ScriptCompiler_compileUnbound.phpt similarity index 93% rename from tests/V8ScriptCompiler_compileUnbound.phpt rename to tests/ScriptCompiler_compileUnbound.phpt index f0ea485..36ac619 100644 --- a/tests/V8ScriptCompiler_compileUnbound.phpt +++ b/tests/ScriptCompiler_compileUnbound.phpt @@ -79,7 +79,7 @@ $cache_data = null; $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is not set', $source->getCachedData() === null); try { - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); } catch (\V8\Exceptions\Exception $e) { $helper->exception_export($e); } @@ -90,7 +90,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status');; $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kProduceCodeCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE); $helper->assert('Source cache data is update', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -103,7 +103,7 @@ $cache_data = null; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -115,7 +115,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"other " + status');; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); @@ -127,7 +127,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, ' "test " + status');; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false); @@ -139,7 +139,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status');; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kProduceCodeCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); @@ -152,7 +152,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status');; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true); @@ -165,7 +165,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, '"test " + status');; $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kProduceParserCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE); $helper->assert('Source cache data is NOT updated', $source->getCachedData() === null); $helper->line(); @@ -177,7 +177,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');; $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kProduceParserCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE); $helper->assert('Source cache data is update', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -192,7 +192,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeParserCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); @@ -205,7 +205,7 @@ $cache_data = null; $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');; $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::kConsumeCodeCache); + $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE); $helper->assert('Source cache data is still set', $source->getCachedData() != null); $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); diff --git a/tests/V8ScriptOrigin.phpt b/tests/ScriptOrigin.phpt similarity index 95% rename from tests/V8ScriptOrigin.phpt rename to tests/ScriptOrigin.phpt index 11ac61c..1dab394 100644 --- a/tests/V8ScriptOrigin.phpt +++ b/tests/ScriptOrigin.phpt @@ -19,7 +19,7 @@ $helper->header('Test getters (default)'); $helper->method_matches_with_output($obj, 'resourceName', 'test'); $helper->method_matches_with_output($obj, 'resourceLineOffset', 0); $helper->method_matches_with_output($obj, 'resourceColumnOffset', 0); -$helper->method_matches_with_output($obj, 'scriptID', 0); +$helper->method_matches_with_output($obj, 'scriptId', 0); $helper->method_matches_with_output($obj, 'sourceMapUrl', ''); $helper->method_matches_instanceof($obj, 'options', V8\ScriptOriginOptions::class); $helper->space(); @@ -43,7 +43,7 @@ $helper->header('Test getters'); $helper->method_matches_with_output($obj, 'resourceName', 'test'); $helper->method_matches_with_output($obj, 'resourceLineOffset', 1); $helper->method_matches_with_output($obj, 'resourceColumnOffset', 2); -$helper->method_matches_with_output($obj, 'scriptID', 3); +$helper->method_matches_with_output($obj, 'scriptId', 3); $helper->method_matches_with_output($obj, 'sourceMapUrl', 'map'); $helper->method_matches_instanceof($obj, 'options', V8\ScriptOriginOptions::class); $helper->space(); @@ -91,7 +91,7 @@ Test getters (default): V8\ScriptOrigin::resourceName() matches expected 'test' V8\ScriptOrigin::resourceLineOffset() matches expected 0 V8\ScriptOrigin::resourceColumnOffset() matches expected 0 -V8\ScriptOrigin::scriptID() matches expected 0 +V8\ScriptOrigin::scriptId() matches expected 0 V8\ScriptOrigin::sourceMapUrl() matches expected '' V8\ScriptOrigin::options() result is instance of V8\ScriptOriginOptions @@ -134,7 +134,7 @@ Test getters: V8\ScriptOrigin::resourceName() matches expected 'test' V8\ScriptOrigin::resourceLineOffset() matches expected 1 V8\ScriptOrigin::resourceColumnOffset() matches expected 2 -V8\ScriptOrigin::scriptID() matches expected 3 +V8\ScriptOrigin::scriptId() matches expected 3 V8\ScriptOrigin::sourceMapUrl() matches expected 'map' V8\ScriptOrigin::options() result is instance of V8\ScriptOriginOptions diff --git a/tests/V8ScriptOriginOptions.phpt b/tests/ScriptOriginOptions.phpt similarity index 100% rename from tests/V8ScriptOriginOptions.phpt rename to tests/ScriptOriginOptions.phpt diff --git a/tests/V8Script_exit_during_script_execution.phpt b/tests/Script_exit_during_script_execution.phpt similarity index 97% rename from tests/V8Script_exit_during_script_execution.phpt rename to tests/Script_exit_during_script_execution.phpt index 7ad8685..800d1c4 100644 --- a/tests/V8Script_exit_during_script_execution.phpt +++ b/tests/Script_exit_during_script_execution.phpt @@ -26,7 +26,7 @@ $exit = new v8Tests\TrackingDtors\FunctionTemplate($isolate, function () { exit(); }); -$global_template->set(new \V8\StringValue($isolate, 'exit'), $exit, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'exit'), $exit, \V8\PropertyAttribute::DONT_DELETE); $context = new v8Tests\TrackingDtors\Context($isolate, $global_template); $v8_helper->injectConsoleLog($context); diff --git a/tests/V8Script_run.phpt b/tests/Script_run.phpt similarity index 100% rename from tests/V8Script_run.phpt rename to tests/Script_run.phpt diff --git a/tests/V8Script_run_out_of_memory.phpt b/tests/Script_run_out_of_memory.phpt similarity index 100% rename from tests/V8Script_run_out_of_memory.phpt rename to tests/Script_run_out_of_memory.phpt diff --git a/tests/V8Script_run_uncaught_exception.phpt b/tests/Script_run_uncaught_exception.phpt similarity index 100% rename from tests/V8Script_run_uncaught_exception.phpt rename to tests/Script_run_uncaught_exception.phpt diff --git a/tests/V8Script_terminate_script_execution.phpt b/tests/Script_terminate_script_execution.phpt similarity index 97% rename from tests/V8Script_terminate_script_execution.phpt rename to tests/Script_terminate_script_execution.phpt index 3245d36..69249f5 100644 --- a/tests/V8Script_terminate_script_execution.phpt +++ b/tests/Script_terminate_script_execution.phpt @@ -38,7 +38,7 @@ $terminate = new V8\FunctionTemplate($isolate, function (\V8\FunctionCallbackInf $e = null; }); -$global_template->set(new \V8\StringValue($isolate, 'terminate'), $terminate, \V8\PropertyAttribute::DontDelete); +$global_template->set(new \V8\StringValue($isolate, 'terminate'), $terminate, \V8\PropertyAttribute::DONT_DELETE); $context = new V8\Context($isolate, $global_template); $v8_helper->injectConsoleLog($context); diff --git a/tests/V8SetObject.phpt b/tests/SetObject.phpt similarity index 100% rename from tests/V8SetObject.phpt rename to tests/SetObject.phpt diff --git a/tests/V8Source.phpt b/tests/Source.phpt similarity index 100% rename from tests/V8Source.phpt rename to tests/Source.phpt diff --git a/tests/V8StackFrame.phpt b/tests/StackFrame.phpt similarity index 100% rename from tests/V8StackFrame.phpt rename to tests/StackFrame.phpt diff --git a/tests/V8StackTrace.phpt b/tests/StackTrace.phpt similarity index 100% rename from tests/V8StackTrace.phpt rename to tests/StackTrace.phpt diff --git a/tests/V8StackTrace_currentStackTrace.phpt b/tests/StackTrace_currentStackTrace.phpt similarity index 100% rename from tests/V8StackTrace_currentStackTrace.phpt rename to tests/StackTrace_currentStackTrace.phpt diff --git a/tests/V8StartupData_createFromSource.phpt b/tests/StartupData_createFromSource.phpt similarity index 100% rename from tests/V8StartupData_createFromSource.phpt rename to tests/StartupData_createFromSource.phpt diff --git a/tests/V8StringObject.phpt b/tests/StringObject.phpt similarity index 100% rename from tests/V8StringObject.phpt rename to tests/StringObject.phpt diff --git a/tests/V8StringValue.phpt b/tests/StringValue.phpt similarity index 97% rename from tests/V8StringValue.phpt rename to tests/StringValue.phpt index 37b3f54..90f7293 100644 --- a/tests/V8StringValue.phpt +++ b/tests/StringValue.phpt @@ -32,6 +32,10 @@ $helper->assert('StringValue extends NameValue', $value instanceof \V8\NameValue $helper->assert('StringValue extends Value', $value instanceof \V8\Value); $helper->line(); +$helper->header('Class constants'); +$helper->dump_object_constants($value); +$helper->space(); + $helper->header('Accessors'); $helper->method_matches($value, 'getIsolate', $isolate); $helper->method_export($value, 'value'); @@ -114,6 +118,11 @@ object(V8\StringValue)#5 (1) { StringValue extends NameValue: ok StringValue extends Value: ok +Class constants: +---------------- +V8\StringValue::MAX_LENGTH = 268435440 + + Accessors: ---------- V8\StringValue::getIsolate() matches expected value diff --git a/tests/V8String_range_error_length.phpt b/tests/String_range_error_length.phpt similarity index 100% rename from tests/V8String_range_error_length.phpt rename to tests/String_range_error_length.phpt diff --git a/tests/V8SymbolObject.phpt b/tests/SymbolObject.phpt similarity index 100% rename from tests/V8SymbolObject.phpt rename to tests/SymbolObject.phpt diff --git a/tests/V8SymbolValue.phpt b/tests/SymbolValue.phpt similarity index 100% rename from tests/V8SymbolValue.phpt rename to tests/SymbolValue.phpt diff --git a/tests/V8TryCatch.phpt b/tests/TryCatch.phpt similarity index 99% rename from tests/V8TryCatch.phpt rename to tests/TryCatch.phpt index a65ba21..e64a0cd 100644 --- a/tests/V8TryCatch.phpt +++ b/tests/TryCatch.phpt @@ -203,7 +203,7 @@ object(V8\TryCatch)#11 (8) { ["code":protected]=> int(0) ["file":protected]=> - string(%d) "%s/V8TryCatch.php" + string(%d) "%s/TryCatch.php" ["line":protected]=> int(%d) ["trace":"Exception":private]=> diff --git a/tests/V8TryCatch_from_script.phpt b/tests/TryCatch_from_script.phpt similarity index 100% rename from tests/V8TryCatch_from_script.phpt rename to tests/TryCatch_from_script.phpt diff --git a/tests/V8Uint32Value.phpt b/tests/Uint32Value.phpt similarity index 100% rename from tests/V8Uint32Value.phpt rename to tests/Uint32Value.phpt diff --git a/tests/V8UnboundScript.phpt b/tests/UnboundScript.phpt similarity index 100% rename from tests/V8UnboundScript.phpt rename to tests/UnboundScript.phpt diff --git a/tests/V8Undefined.phpt b/tests/Undefined.phpt similarity index 100% rename from tests/V8Undefined.phpt rename to tests/Undefined.phpt diff --git a/tests/V8UndefinedValue_destruct.phpt b/tests/UndefinedValue_destruct.phpt similarity index 100% rename from tests/V8UndefinedValue_destruct.phpt rename to tests/UndefinedValue_destruct.phpt diff --git a/tests/V8UndefinedValue_invalid_ctor_arg_type.phpt b/tests/UndefinedValue_invalid_ctor_arg_type.phpt similarity index 100% rename from tests/V8UndefinedValue_invalid_ctor_arg_type.phpt rename to tests/UndefinedValue_invalid_ctor_arg_type.phpt diff --git a/tests/V8Value_empty.phpt b/tests/Value_empty.phpt similarity index 100% rename from tests/V8Value_empty.phpt rename to tests/Value_empty.phpt diff --git a/v8.cc b/v8.cc index da47596..17574b9 100644 --- a/v8.cc +++ b/v8.cc @@ -21,7 +21,7 @@ #include "php_v8_startup_data.h" #include "php_v8_heap_statistics.h" #include "php_v8_exceptions.h" -#include "php_v8_exception.h" +#include "php_v8_exception_manager.h" #include "php_v8_try_catch.h" #include "php_v8_message.h" #include "php_v8_stack_frame.h" @@ -116,7 +116,7 @@ PHP_MINIT_FUNCTION(v8) PHP_MINIT(php_v8_source)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_script_compiler)(INIT_FUNC_ARGS_PASSTHRU); - PHP_MINIT(php_v8_exception)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(php_v8_exception_manger)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_try_catch)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_message)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_stack_frame)(INIT_FUNC_ARGS_PASSTHRU);