summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c2579
-rw-r--r--ext/reflection/php_reflection.h2
-rw-r--r--ext/reflection/php_reflection.stub.php638
-rw-r--r--ext/reflection/php_reflection_arginfo.h929
-rw-r--r--ext/reflection/tests/001.phpt31
-rw-r--r--ext/reflection/tests/002.phpt20
-rw-r--r--ext/reflection/tests/003.phpt18
-rw-r--r--ext/reflection/tests/004.phpt14
-rw-r--r--ext/reflection/tests/005.phpt18
-rw-r--r--ext/reflection/tests/006.phpt105
-rw-r--r--ext/reflection/tests/007.phpt117
-rw-r--r--ext/reflection/tests/008.phpt26
-rw-r--r--ext/reflection/tests/009.phpt2
-rw-r--r--ext/reflection/tests/010.phpt10
-rw-r--r--ext/reflection/tests/012.phpt2
-rw-r--r--ext/reflection/tests/017.phpt2
-rw-r--r--ext/reflection/tests/020.phpt14
-rw-r--r--ext/reflection/tests/021.phpt2
-rw-r--r--ext/reflection/tests/022.phpt2
-rw-r--r--ext/reflection/tests/023.phpt12
-rw-r--r--ext/reflection/tests/024.phpt12
-rw-r--r--ext/reflection/tests/025.phpt2
-rw-r--r--ext/reflection/tests/027.phpt6
-rw-r--r--ext/reflection/tests/028.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClassConstant_basic1.phpt50
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_001.phpt8
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_002.phpt47
-rw-r--r--ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic1.phpt22
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic2.phpt22
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_basic.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_error.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstants_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt76
-rw-r--r--ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt82
-rw-r--r--ext/reflection/tests/ReflectionClass_getDocComment_001.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtension_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtension_variation.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_001.phpt54
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_002.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethods_001.phpt36
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethods_003.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getName_basic.phpt8
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass.phpt7
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass_001.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperties_001.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperties_003.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_001.phpt78
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_002.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_003.phpt84
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_004.phpt84
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt24
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt41
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_001.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_002.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_001.phpt46
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_002.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_001.phpt46
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt70
-rw-r--r--ext/reflection/tests/ReflectionClass_isArray.phpt8
-rw-r--r--ext/reflection/tests/ReflectionClass_isCloneable_001.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstance_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt41
-rw-r--r--ext/reflection/tests/ReflectionClass_isInternal_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_001.phpt57
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_error2.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_modifiers_001.phpt10
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt69
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt10
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstance_001.phpt63
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt24
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt51
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_001.phpt46
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_002.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_003.phpt12
-rw-r--r--ext/reflection/tests/ReflectionExtension_bug66218.phpt1
-rw-r--r--ext/reflection/tests/ReflectionExtension_constructor_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_constructor_error.phpt16
-rw-r--r--ext/reflection/tests/ReflectionExtension_export_basic.phpt18
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt25
-rw-r--r--ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getName_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_info_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_isPersistant.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_isTemporary.phpt2
-rw-r--r--ext/reflection/tests/ReflectionFunction_001.phpt22
-rw-r--r--ext/reflection/tests/ReflectionFunction_construct.001.phpt26
-rw-r--r--ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt6
-rw-r--r--ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt12
-rw-r--r--ext/reflection/tests/ReflectionFunction_getFileName.002.phpt12
-rw-r--r--ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt18
-rw-r--r--ext/reflection/tests/ReflectionGenerator_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionGenerator_getTrace.phpt4
-rw-r--r--ext/reflection/tests/ReflectionGenerator_in_Generator.phpt34
-rw-r--r--ext/reflection/tests/ReflectionMethod_006.phpt82
-rw-r--r--ext/reflection/tests/ReflectionMethod_basic2.phpt88
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt70
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_error1.phpt56
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_error2.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_defaultArg.phpt6
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosureThis.phpt18
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_error.phpt45
-rw-r--r--ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt22
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt40
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_basic.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error1.phpt8
-rw-r--r--ext/reflection/tests/ReflectionNamedType.phpt22
-rw-r--r--ext/reflection/tests/ReflectionObject___toString_basic1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject___toString_basic2.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_export_basic1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_export_basic2.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_export_basic3.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstant_basic.phpt12
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstants_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt62
-rw-r--r--ext/reflection/tests/ReflectionObject_getName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstance_basic.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt83
-rw-r--r--ext/reflection/tests/ReflectionObject_isInternal_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt38
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt30
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionParameter_001.phpt22
-rw-r--r--ext/reflection/tests/ReflectionParameter_002.phpt12
-rw-r--r--ext/reflection/tests/ReflectionParameter_003.phpt46
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt34
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt28
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt13
-rw-r--r--ext/reflection/tests/ReflectionParameter_export_basic.phpt8
-rw-r--r--ext/reflection/tests/ReflectionParameter_export_error2.phpt34
-rw-r--r--ext/reflection/tests/ReflectionParameter_export_error3.phpt23
-rw-r--r--ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt7
-rw-r--r--ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt16
-rw-r--r--ext/reflection/tests/ReflectionParameter_isDefault.phpt2
-rw-r--r--ext/reflection/tests/ReflectionParameter_toString_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_basic1.phpt60
-rw-r--r--ext/reflection/tests/ReflectionProperty_constructor_error.phpt2
-rw-r--r--ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt38
-rw-r--r--ext/reflection/tests/ReflectionProperty_error.phpt45
-rw-r--r--ext/reflection/tests/ReflectionProperty_export_basic.phpt14
-rw-r--r--ext/reflection/tests/ReflectionProperty_export_error.phpt64
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt73
-rw-r--r--ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt16
-rw-r--r--ext/reflection/tests/ReflectionProperty_getValue_error.phpt61
-rw-r--r--ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt60
-rw-r--r--ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt7
-rw-r--r--ext/reflection/tests/ReflectionProperty_isInitialized.phpt19
-rw-r--r--ext/reflection/tests/ReflectionProperty_setValue_error.phpt59
-rw-r--r--ext/reflection/tests/ReflectionProperty_typed_static.phpt2
-rw-r--r--ext/reflection/tests/ReflectionReference_errors.phpt4
-rw-r--r--ext/reflection/tests/ReflectionType_001.phpt46
-rw-r--r--ext/reflection/tests/ReflectionZendExtension.phpt4
-rw-r--r--ext/reflection/tests/ReflectionZendExtension_error.phpt2
-rw-r--r--ext/reflection/tests/bug26640.phpt16
-rw-r--r--ext/reflection/tests/bug26695.phpt2
-rw-r--r--ext/reflection/tests/bug29268.phpt12
-rw-r--r--ext/reflection/tests/bug29523.phpt18
-rw-r--r--ext/reflection/tests/bug29828.phpt12
-rw-r--r--ext/reflection/tests/bug30146.phpt2
-rw-r--r--ext/reflection/tests/bug30148.phpt36
-rw-r--r--ext/reflection/tests/bug30209.phpt26
-rw-r--r--ext/reflection/tests/bug30856.phpt2
-rw-r--r--ext/reflection/tests/bug31651.phpt2
-rw-r--r--ext/reflection/tests/bug32981.phpt14
-rw-r--r--ext/reflection/tests/bug36434.phpt18
-rw-r--r--ext/reflection/tests/bug37816.phpt8
-rw-r--r--ext/reflection/tests/bug37964.phpt18
-rw-r--r--ext/reflection/tests/bug38132.phpt4
-rw-r--r--ext/reflection/tests/bug38217.phpt14
-rw-r--r--ext/reflection/tests/bug38653.phpt6
-rw-r--r--ext/reflection/tests/bug38942.phpt35
-rw-r--r--ext/reflection/tests/bug39001.phpt4
-rw-r--r--ext/reflection/tests/bug39067.phpt10
-rw-r--r--ext/reflection/tests/bug40431.phpt2
-rw-r--r--ext/reflection/tests/bug40794.phpt2
-rw-r--r--ext/reflection/tests/bug41061.phpt3
-rw-r--r--ext/reflection/tests/bug41884.phpt4
-rw-r--r--ext/reflection/tests/bug42976.phpt10
-rw-r--r--ext/reflection/tests/bug45139.phpt14
-rw-r--r--ext/reflection/tests/bug45571.phpt14
-rw-r--r--ext/reflection/tests/bug45765.phpt20
-rw-r--r--ext/reflection/tests/bug46064.phpt22
-rw-r--r--ext/reflection/tests/bug46064_2.phpt24
-rw-r--r--ext/reflection/tests/bug46205.phpt15
-rw-r--r--ext/reflection/tests/bug47254.phpt9
-rw-r--r--ext/reflection/tests/bug48757.phpt4
-rw-r--r--ext/reflection/tests/bug49074.phpt8
-rw-r--r--ext/reflection/tests/bug49719.phpt22
-rw-r--r--ext/reflection/tests/bug51905.phpt6
-rw-r--r--ext/reflection/tests/bug52854.phpt4
-rw-r--r--ext/reflection/tests/bug53366.phpt2
-rw-r--r--ext/reflection/tests/bug53915.phpt4
-rw-r--r--ext/reflection/tests/bug60367.phpt10
-rw-r--r--ext/reflection/tests/bug62715.phpt3
-rw-r--r--ext/reflection/tests/bug64239.phpt6
-rw-r--r--ext/reflection/tests/bug64936.phpt6
-rw-r--r--ext/reflection/tests/bug66430.phpt8
-rw-r--r--ext/reflection/tests/bug69180.phpt37
-rw-r--r--ext/reflection/tests/bug70982.phpt10
-rw-r--r--ext/reflection/tests/bug72661.phpt3
-rw-r--r--ext/reflection/tests/bug74454.inc2
-rw-r--r--ext/reflection/tests/bug74454.phpt8
-rw-r--r--ext/reflection/tests/bug74673.phpt17
-rw-r--r--ext/reflection/tests/bug74949.phpt4
-rw-r--r--ext/reflection/tests/bug76536.phpt2
-rw-r--r--ext/reflection/tests/bug77325.phpt29
-rw-r--r--ext/reflection/tests/bug77882.phpt2
-rw-r--r--ext/reflection/tests/bug78774.phpt6
-rw-r--r--ext/reflection/tests/bug78895.phpt12
-rw-r--r--ext/reflection/tests/closures_001.phpt10
-rw-r--r--ext/reflection/tests/closures_002.phpt6
-rw-r--r--ext/reflection/tests/closures_003.phpt2
-rw-r--r--ext/reflection/tests/closures_003_v1.phpt2
-rw-r--r--ext/reflection/tests/closures_004.phpt2
-rw-r--r--ext/reflection/tests/included4.inc4
-rw-r--r--ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValueConstantName_Internal.phpt53
-rw-r--r--ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValue_Internal.phpt37
-rw-r--r--ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueAvailable_Internal.phpt28
-rw-r--r--ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueConstant_Internal.phpt36
-rw-r--r--ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_toString_Internal.phpt28
-rw-r--r--ext/reflection/tests/internal_parameter_default_value/check_all.phpt33
-rw-r--r--ext/reflection/tests/parameters_001.phpt12
-rw-r--r--ext/reflection/tests/parameters_002.phpt75
-rw-r--r--ext/reflection/tests/property_exists.phpt117
-rw-r--r--ext/reflection/tests/request38992.phpt21
-rw-r--r--ext/reflection/tests/static_properties_002.phpt32
-rw-r--r--ext/reflection/tests/static_type.phpt22
-rw-r--r--ext/reflection/tests/union_types.phpt112
253 files changed, 4979 insertions, 4626 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index dbfb67386e..6023ef0c0d 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -43,6 +41,7 @@
#include "zend_extensions.h"
#include "zend_builtin_functions.h"
#include "zend_smart_str.h"
+#include "php_reflection_arginfo.h"
/* Key used to avoid leaking addresses in ReflectionProperty::getId() */
#define REFLECTION_KEY_LEN 16
@@ -76,6 +75,7 @@ PHPAPI zend_class_entry *reflection_generator_ptr;
PHPAPI zend_class_entry *reflection_parameter_ptr;
PHPAPI zend_class_entry *reflection_type_ptr;
PHPAPI zend_class_entry *reflection_named_type_ptr;
+PHPAPI zend_class_entry *reflection_union_type_ptr;
PHPAPI zend_class_entry *reflection_class_ptr;
PHPAPI zend_class_entry *reflection_object_ptr;
PHPAPI zend_class_entry *reflection_method_ptr;
@@ -93,10 +93,10 @@ PHPAPI zend_class_entry *reflection_reference_ptr;
intern = Z_REFLECTION_P(ZEND_THIS); \
if (intern->ptr == NULL) { \
if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { \
- return; \
+ RETURN_THROWS(); \
} \
zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); \
- return; \
+ RETURN_THROWS(); \
} \
} while (0)
@@ -113,9 +113,8 @@ PHPAPI zend_class_entry *reflection_reference_ptr;
/* Struct for properties */
typedef struct _property_reference {
- zend_property_info prop;
+ zend_property_info *prop;
zend_string *unmangled_name;
- zend_bool dynamic;
} property_reference;
/* Struct for parameters */
@@ -129,6 +128,8 @@ typedef struct _parameter_reference {
/* Struct for type hints */
typedef struct _type_reference {
zend_type type;
+ /* Whether to use backwards compatible null representation */
+ zend_bool legacy_behavior;
} type_reference;
typedef enum {
@@ -160,25 +161,22 @@ static inline reflection_object *reflection_object_from_obj(zend_object *obj) {
static zend_object_handlers reflection_object_handlers;
+static zend_always_inline uint32_t prop_get_flags(property_reference *ref) {
+ return ref->prop ? ref->prop->flags : ZEND_ACC_PUBLIC;
+}
+
static inline zend_bool is_closure_invoke(zend_class_entry *ce, zend_string *lcname) {
return ce == zend_ce_closure
&& zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME);
}
-static zval *_default_load_name(zval *object) /* {{{ */
-{
- return zend_hash_find_ex_ind(Z_OBJPROP_P(object), ZSTR_KNOWN(ZEND_STR_NAME), 1);
-}
-/* }}} */
-
static void _default_get_name(zval *object, zval *return_value) /* {{{ */
{
- zval *value;
-
- if ((value = _default_load_name(object)) == NULL) {
+ zval *name = reflection_prop_name(object);
+ if (Z_ISUNDEF_P(name)) {
RETURN_FALSE;
}
- ZVAL_COPY(return_value, value);
+ ZVAL_COPY(return_value, name);
}
/* }}} */
@@ -226,7 +224,7 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
case REF_TYPE_TYPE:
{
type_reference *type_ref = intern->ptr;
- if (ZEND_TYPE_IS_NAME(type_ref->type)) {
+ if (ZEND_TYPE_HAS_NAME(type_ref->type)) {
zend_string_release(ZEND_TYPE_NAME(type_ref->type));
}
efree(type_ref);
@@ -252,9 +250,9 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *reflection_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- reflection_object *intern = Z_REFLECTION_P(obj);
+ reflection_object *intern = reflection_object_from_obj(obj);
*gc_data = &intern->obj;
*gc_data_count = 1;
return zend_std_get_properties(obj);
@@ -281,7 +279,7 @@ static zval *reflection_instantiate(zend_class_entry *pce, zval *object) /* {{{
static void _const_string(smart_str *str, char *name, zval *value, char *indent);
static void _function_string(smart_str *str, zend_function *fptr, zend_class_entry *scope, char* indent);
-static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent, zend_bool dynamic);
+static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent);
static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char* indent);
static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char *indent);
static void _extension_string(smart_str *str, zend_module_entry *module, char *indent);
@@ -396,7 +394,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if ((prop->flags & ZEND_ACC_STATIC) && (!(prop->flags & ZEND_ACC_PRIVATE) || prop->ce == ce)) {
- _property_string(str, prop, NULL, ZSTR_VAL(sub_indent), 0);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent));
}
} ZEND_HASH_FOREACH_END();
}
@@ -444,14 +442,14 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if (!(prop->flags & ZEND_ACC_STATIC)
&& (!(prop->flags & ZEND_ACC_PRIVATE) || prop->ce == ce)) {
- _property_string(str, prop, NULL, ZSTR_VAL(sub_indent), 0);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent));
}
} ZEND_HASH_FOREACH_END();
}
smart_str_append_printf(str, "%s }\n", indent);
if (obj && Z_TYPE_P(obj) == IS_OBJECT) {
- HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
zend_string *prop_name;
smart_str prop_str = {0};
@@ -461,7 +459,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */
if (!zend_hash_exists(&ce->properties_info, prop_name)) {
count++;
- _property_string(&prop_str, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent), 0);
+ _property_string(&prop_str, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent));
}
}
} ZEND_HASH_FOREACH_END();
@@ -518,7 +516,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
/* {{{ _const_string */
static void _const_string(smart_str *str, char *name, zval *value, char *indent)
{
- char *type = zend_zval_type_name(value);
+ const char *type = zend_zval_type_name(value);
if (Z_TYPE_P(value) == IS_ARRAY) {
smart_str_append_printf(str, "%s Constant [ %s %s ] { Array }\n",
@@ -540,7 +538,7 @@ static void _const_string(smart_str *str, char *name, zval *value, char *indent)
static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char *indent)
{
char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value));
- char *type;
+ const char *type;
zval_update_constant_ex(&c->value, c->ce);
type = zend_zval_type_name(&c->value);
@@ -560,8 +558,7 @@ static void _class_const_string(smart_str *str, char *name, zend_class_constant
}
/* }}} */
-/* {{{ _get_recv_opcode */
-static zend_op* _get_recv_op(zend_op_array *op_array, uint32_t offset)
+static zend_op *get_recv_op(zend_op_array *op_array, uint32_t offset)
{
zend_op *op = op_array->opcodes;
zend_op *end = op + op_array->last;
@@ -575,9 +572,56 @@ static zend_op* _get_recv_op(zend_op_array *op_array, uint32_t offset)
}
++op;
}
+ ZEND_ASSERT(0 && "Failed to find op");
return NULL;
}
-/* }}} */
+
+static zval *get_default_from_recv(zend_op_array *op_array, uint32_t offset) {
+ zend_op *recv = get_recv_op(op_array, offset);
+ if (!recv || recv->opcode != ZEND_RECV_INIT) {
+ return NULL;
+ }
+
+ return RT_CONSTANT(recv, recv->op2);
+}
+
+static int format_default_value(smart_str *str, zval *value, zend_class_entry *scope) {
+ zval zv;
+ ZVAL_COPY(&zv, value);
+ if (UNEXPECTED(zval_update_constant_ex(&zv, scope) == FAILURE)) {
+ zval_ptr_dtor(&zv);
+ return FAILURE;
+ }
+
+ if (Z_TYPE(zv) == IS_TRUE) {
+ smart_str_appends(str, "true");
+ } else if (Z_TYPE(zv) == IS_FALSE) {
+ smart_str_appends(str, "false");
+ } else if (Z_TYPE(zv) == IS_NULL) {
+ smart_str_appends(str, "NULL");
+ } else if (Z_TYPE(zv) == IS_STRING) {
+ smart_str_appendc(str, '\'');
+ smart_str_appendl(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
+ if (Z_STRLEN(zv) > 15) {
+ smart_str_appends(str, "...");
+ }
+ smart_str_appendc(str, '\'');
+ } else if (Z_TYPE(zv) == IS_ARRAY) {
+ smart_str_appends(str, "Array");
+ } else {
+ zend_string *tmp_zv_str;
+ zend_string *zv_str = zval_get_tmp_string(&zv, &tmp_zv_str);
+ smart_str_append(str, zv_str);
+ zend_tmp_string_release(tmp_zv_str);
+ }
+ zval_ptr_dtor(&zv);
+ return SUCCESS;
+}
+
+static inline zend_bool has_internal_arg_info(const zend_function *fptr) {
+ return fptr->type == ZEND_INTERNAL_FUNCTION
+ && !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO);
+}
/* {{{ _parameter_string */
static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_arg_info *arg_info, uint32_t offset, zend_bool required, char* indent)
@@ -588,66 +632,37 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_
} else {
smart_str_append_printf(str, "<required> ");
}
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- smart_str_append_printf(str, "%s ",
- ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type)));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ smart_str_append(str, type_str);
+ smart_str_appendc(str, ' ');
+ zend_string_release(type_str);
}
- if (arg_info->pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(arg_info)) {
smart_str_appendc(str, '&');
}
- if (arg_info->is_variadic) {
+ if (ZEND_ARG_IS_VARIADIC(arg_info)) {
smart_str_appends(str, "...");
}
- if (arg_info->name) {
- smart_str_append_printf(str, "$%s",
- (fptr->type == ZEND_INTERNAL_FUNCTION &&
- !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) ?
- ((zend_internal_arg_info*)arg_info)->name :
- ZSTR_VAL(arg_info->name));
- } else {
- smart_str_append_printf(str, "$param%d", offset);
- }
- if (fptr->type == ZEND_USER_FUNCTION && !required) {
- zend_op *precv = _get_recv_op((zend_op_array*)fptr, offset);
- if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
- zval zv;
+ smart_str_append_printf(str, "$%s", has_internal_arg_info(fptr)
+ ? ((zend_internal_arg_info*)arg_info)->name : ZSTR_VAL(arg_info->name));
+ if (!required) {
+ if (fptr->type == ZEND_INTERNAL_FUNCTION) {
smart_str_appends(str, " = ");
- ZVAL_COPY(&zv, RT_CONSTANT(precv, precv->op2));
- if (UNEXPECTED(zval_update_constant_ex(&zv, fptr->common.scope) == FAILURE)) {
- zval_ptr_dtor(&zv);
- return;
+ if (((zend_internal_arg_info*)arg_info)->default_value) {
+ smart_str_appends(str, ((zend_internal_arg_info*)arg_info)->default_value);
+ } else {
+ smart_str_appends(str, "<default>");
}
- if (Z_TYPE(zv) == IS_TRUE) {
- smart_str_appends(str, "true");
- } else if (Z_TYPE(zv) == IS_FALSE) {
- smart_str_appends(str, "false");
- } else if (Z_TYPE(zv) == IS_NULL) {
- smart_str_appends(str, "NULL");
- } else if (Z_TYPE(zv) == IS_STRING) {
- smart_str_appendc(str, '\'');
- smart_str_appendl(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
- if (Z_STRLEN(zv) > 15) {
- smart_str_appends(str, "...");
+ } else {
+ zval *default_value = get_default_from_recv((zend_op_array*)fptr, offset);
+ if (default_value) {
+ smart_str_appends(str, " = ");
+ if (format_default_value(str, default_value, fptr->common.scope) == FAILURE) {
+ return;
}
- smart_str_appendc(str, '\'');
- } else if (Z_TYPE(zv) == IS_ARRAY) {
- smart_str_appends(str, "Array");
- } else {
- zend_string *tmp_zv_str;
- zend_string *zv_str = zval_get_tmp_string(&zv, &tmp_zv_str);
- smart_str_append(str, zv_str);
- zend_tmp_string_release(tmp_zv_str);
}
- zval_ptr_dtor(&zv);
}
}
smart_str_appends(str, " ]");
@@ -808,17 +823,10 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
smart_str_free(&param_indent);
if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
smart_str_append_printf(str, " %s- Return [ ", indent);
- if (ZEND_TYPE_IS_CLASS(fptr->common.arg_info[-1].type)) {
- smart_str_append_printf(str, "%s ",
- ZSTR_VAL(ZEND_TYPE_NAME(fptr->common.arg_info[-1].type)));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
- } else if (ZEND_TYPE_IS_CODE(fptr->common.arg_info[-1].type)) {
- smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(fptr->common.arg_info[-1].type)));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
+ if (ZEND_TYPE_IS_SET(fptr->common.arg_info[-1].type)) {
+ zend_string *type_str = zend_type_to_string(fptr->common.arg_info[-1].type);
+ smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
smart_str_appends(str, "]\n");
}
@@ -826,21 +834,24 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
}
/* }}} */
+static zval *property_get_default(zend_property_info *prop_info) {
+ zend_class_entry *ce = prop_info->ce;
+ if (prop_info->flags & ZEND_ACC_STATIC) {
+ zval *prop = &ce->default_static_members_table[prop_info->offset];
+ ZVAL_DEINDIRECT(prop);
+ return prop;
+ } else {
+ return &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
+ }
+}
+
/* {{{ _property_string */
-static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent, zend_bool dynamic)
+static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent)
{
smart_str_append_printf(str, "%sProperty [ ", indent);
if (!prop) {
smart_str_append_printf(str, "<dynamic> public $%s", prop_name);
} else {
- if (!(prop->flags & ZEND_ACC_STATIC)) {
- if (dynamic) {
- smart_str_appends(str, "<implicit> ");
- } else {
- smart_str_appends(str, "<default> ");
- }
- }
-
/* These are mutually exclusive */
switch (prop->flags & ZEND_ACC_PPP_MASK) {
case ZEND_ACC_PUBLIC:
@@ -856,11 +867,25 @@ static void _property_string(smart_str *str, zend_property_info *prop, const cha
if (prop->flags & ZEND_ACC_STATIC) {
smart_str_appends(str, "static ");
}
+ if (ZEND_TYPE_IS_SET(prop->type)) {
+ zend_string *type_str = zend_type_to_string(prop->type);
+ smart_str_append(str, type_str);
+ smart_str_appendc(str, ' ');
+ zend_string_release(type_str);
+ }
if (!prop_name) {
const char *class_name;
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
}
smart_str_append_printf(str, "$%s", prop_name);
+
+ zval *default_value = property_get_default(prop);
+ if (!Z_ISUNDEF_P(default_value)) {
+ smart_str_appends(str, " = ");
+ if (format_default_value(str, default_value, prop->ce) == FAILURE) {
+ return;
+ }
+ }
}
smart_str_appends(str, " ]\n");
@@ -1064,7 +1089,7 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
zend_function *mptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & mask);
@@ -1133,35 +1158,54 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
}
prop_name = reflection_prop_name(object);
- if (arg_info->name) {
- if (fptr->type == ZEND_INTERNAL_FUNCTION &&
- !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) {
- ZVAL_STRING(prop_name, ((zend_internal_arg_info*)arg_info)->name);
- } else {
- ZVAL_STR_COPY(prop_name, arg_info->name);
- }
+ if (has_internal_arg_info(fptr)) {
+ ZVAL_STRING(prop_name, ((zend_internal_arg_info*)arg_info)->name);
} else {
- ZVAL_NULL(prop_name);
+ ZVAL_STR_COPY(prop_name, arg_info->name);
}
}
/* }}} */
+/* For backwards compatibility reasons, we need to return T|null style unions
+ * as a ReflectionNamedType. Here we determine what counts as a union type and
+ * what doesn't. */
+static zend_bool is_union_type(zend_type type) {
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ return 1;
+ }
+ uint32_t type_mask_without_null = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(type);
+ if (ZEND_TYPE_HAS_CLASS(type)) {
+ return type_mask_without_null != 0;
+ }
+ if (type_mask_without_null == MAY_BE_BOOL) {
+ return 0;
+ }
+ /* Check that only one bit is set. */
+ return (type_mask_without_null & (type_mask_without_null - 1)) != 0;
+}
+
/* {{{ reflection_type_factory */
-static void reflection_type_factory(zend_type type, zval *object)
+static void reflection_type_factory(zend_type type, zval *object, zend_bool legacy_behavior)
{
reflection_object *intern;
type_reference *reference;
+ zend_bool is_union = is_union_type(type);
- reflection_instantiate(reflection_named_type_ptr, object);
+ reflection_instantiate(
+ is_union ? reflection_union_type_ptr : reflection_named_type_ptr, object);
intern = Z_REFLECTION_P(object);
reference = (type_reference*) emalloc(sizeof(type_reference));
reference->type = type;
+ reference->legacy_behavior = legacy_behavior && !is_union;
intern->ptr = reference;
intern->ref_type = REF_TYPE_TYPE;
- /* Property types may be resolved during the lifetime of the ReflectionType,
- * so we need to make sure that the strings we reference are not released. */
- if (ZEND_TYPE_IS_NAME(type)) {
+ /* Property types may be resolved during the lifetime of the ReflectionType.
+ * If we reference a string, make sure it doesn't get released. However, only
+ * do this for the top-level type, as resolutions inside type lists will be
+ * fully visible to us (we'd have to do a fully copy of the type if we wanted
+ * to prevent that). */
+ if (ZEND_TYPE_HAS_NAME(type)) {
zend_string_addref(ZEND_TYPE_NAME(type));
}
}
@@ -1199,60 +1243,40 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
ZVAL_OBJ(&intern->obj, Z_OBJ_P(closure_object));
}
- ZVAL_STR_COPY(reflection_prop_name(object),
- (method->common.scope && method->common.scope->trait_aliases)
- ? zend_resolve_method_name(ce, method) : method->common.function_name);
+ ZVAL_STR_COPY(reflection_prop_name(object), method->common.function_name);
ZVAL_STR_COPY(reflection_prop_class(object), method->common.scope->name);
}
/* }}} */
/* {{{ reflection_property_factory */
-static void reflection_property_factory(zend_class_entry *ce, zend_string *name, zend_property_info *prop, zval *object, zend_bool dynamic)
+static void reflection_property_factory(zend_class_entry *ce, zend_string *name, zend_property_info *prop, zval *object)
{
reflection_object *intern;
property_reference *reference;
- if (!(prop->flags & ZEND_ACC_PRIVATE)) {
- /* we have to search the class hierarchy for this (implicit) public or protected property */
- zend_class_entry *tmp_ce = ce, *store_ce = ce;
- zend_property_info *tmp_info = NULL;
-
- while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) {
- ce = tmp_ce;
- tmp_ce = tmp_ce->parent;
- }
-
- if (tmp_info && (!(tmp_info->flags & ZEND_ACC_PRIVATE) || tmp_info->ce == tmp_ce)) { /* found something and it's not a parent's private */
- prop = tmp_info;
- } else { /* not found, use initial value */
- ce = store_ce;
- }
- }
-
reflection_instantiate(reflection_property_ptr, object);
intern = Z_REFLECTION_P(object);
reference = (property_reference*) emalloc(sizeof(property_reference));
- reference->prop = *prop;
+ reference->prop = prop;
reference->unmangled_name = zend_string_copy(name);
- reference->dynamic = dynamic;
intern->ptr = reference;
intern->ref_type = REF_TYPE_PROPERTY;
intern->ce = ce;
intern->ignore_visibility = 0;
ZVAL_STR_COPY(reflection_prop_name(object), name);
- ZVAL_STR_COPY(reflection_prop_class(object), prop->ce->name);
+ ZVAL_STR_COPY(reflection_prop_class(object), prop ? prop->ce->name : ce->name);
}
/* }}} */
static void reflection_property_factory_str(zend_class_entry *ce, const char *name_str, size_t name_len, zend_property_info *prop, zval *object)
{
zend_string *name = zend_string_init(name_str, name_len, 0);
- reflection_property_factory(ce, name, prop, object, 0);
+ reflection_property_factory(ce, name, prop, object);
zend_string_release(name);
}
/* {{{ reflection_class_constant_factory */
-static void reflection_class_constant_factory(zend_class_entry *ce, zend_string *name_str, zend_class_constant *constant, zval *object)
+static void reflection_class_constant_factory(zend_string *name_str, zend_class_constant *constant, zval *object)
{
reflection_object *intern;
@@ -1264,182 +1288,41 @@ static void reflection_class_constant_factory(zend_class_entry *ce, zend_string
intern->ignore_visibility = 0;
ZVAL_STR_COPY(reflection_prop_name(object), name_str);
- ZVAL_STR_COPY(reflection_prop_class(object), ce->name);
+ ZVAL_STR_COPY(reflection_prop_class(object), constant->ce->name);
}
/* }}} */
-static void reflection_export_impl(zval *return_value, zval *object, zend_bool return_output) {
- zval fname, retval;
- int result;
-
- /* Invoke the __toString() method */
- ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1);
- result = call_user_function(NULL, object, &fname, &retval, 0, NULL);
- zval_ptr_dtor_str(&fname);
-
- if (result == FAILURE) {
- _DO_THROW("Invocation of method __toString() failed");
- return;
- }
-
- if (Z_TYPE(retval) == IS_UNDEF) {
- php_error_docref(NULL, E_WARNING, "%s::__toString() did not return anything", ZSTR_VAL(Z_OBJCE_P(object)->name));
- RETURN_FALSE;
- }
-
- if (return_output) {
- ZVAL_COPY_VALUE(return_value, &retval);
+static int get_parameter_default(zval *result, parameter_reference *param) {
+ if (param->fptr->type == ZEND_INTERNAL_FUNCTION) {
+ return zend_get_default_from_internal_arg_info(
+ result, (zend_internal_arg_info *) param->arg_info);
} else {
- /* No need for _r variant, return of __toString should always be a string */
- zend_print_zval(&retval, 0);
- zend_printf("\n");
- zval_ptr_dtor(&retval);
- }
-}
-
-/* {{{ _reflection_export */
-static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int ctor_argc)
-{
- zval reflector;
- zval *argument_ptr, *argument2_ptr;
- zval retval, params[2];
- int result;
- int return_output = 0;
- zend_fcall_info fci;
- zend_fcall_info_cache fcc;
-
- if (ctor_argc == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &argument_ptr, &return_output) == FAILURE) {
- return;
- }
- ZVAL_COPY_VALUE(&params[0], argument_ptr);
- ZVAL_NULL(&params[1]);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &argument_ptr, &argument2_ptr, &return_output) == FAILURE) {
- return;
+ zval *default_value = get_default_from_recv((zend_op_array *) param->fptr, param->offset);
+ if (!default_value) {
+ return FAILURE;
}
- ZVAL_COPY_VALUE(&params[0], argument_ptr);
- ZVAL_COPY_VALUE(&params[1], argument2_ptr);
- }
-
- /* Create object */
- if (object_init_ex(&reflector, ce_ptr) == FAILURE) {
- _DO_THROW("Could not create reflector");
- return;
- }
-
- /* Call __construct() */
-
- fci.size = sizeof(fci);
- ZVAL_UNDEF(&fci.function_name);
- fci.object = Z_OBJ(reflector);
- fci.retval = &retval;
- fci.param_count = ctor_argc;
- fci.params = params;
- fci.no_separation = 1;
-
- fcc.function_handler = ce_ptr->constructor;
- fcc.called_scope = Z_OBJCE(reflector);
- fcc.object = Z_OBJ(reflector);
-
- result = zend_call_function(&fci, &fcc);
-
- zval_ptr_dtor(&retval);
- if (EG(exception)) {
- zval_ptr_dtor(&reflector);
- return;
- }
- if (result == FAILURE) {
- zval_ptr_dtor(&reflector);
- _DO_THROW("Could not create reflector");
- return;
+ ZVAL_COPY(result, default_value);
+ return SUCCESS;
}
-
- reflection_export_impl(return_value, &reflector, return_output);
-
- /* Destruct reflector which is no longer needed */
- zval_ptr_dtor(&reflector);
}
-/* }}} */
-
-/* {{{ _reflection_param_get_default_param */
-static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTION_PARAMETERS)
-{
- reflection_object *intern;
- parameter_reference *param;
-
- intern = Z_REFLECTION_P(ZEND_THIS);
- if (intern->ptr == NULL) {
- if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) {
- return NULL;
- }
- zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object");
- return NULL;
- }
-
- param = intern->ptr;
- if (param->fptr->type != ZEND_USER_FUNCTION) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Cannot determine default value for internal functions");
- return NULL;
- }
-
- return param;
-}
-/* }}} */
-
-/* {{{ _reflection_param_get_default_precv */
-static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS, parameter_reference *param)
-{
- zend_op *precv;
-
- if (param == NULL) {
- return NULL;
- }
-
- precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
- if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) {
- zend_throw_exception_ex(reflection_exception_ptr, 0, "Internal error: Failed to retrieve the default value");
- return NULL;
- }
-
- return precv;
-}
-/* }}} */
/* {{{ Preventing __clone from being called */
-ZEND_METHOD(reflection, __clone)
+ZEND_METHOD(ReflectionClass, __clone)
{
/* Should never be executable */
_DO_THROW("Cannot clone object using __clone()");
}
/* }}} */
-/* {{{ proto public static mixed Reflection::export(Reflector r [, bool return])
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection, export)
-{
- zval *object;
- zend_bool return_output = 0;
-
- ZEND_PARSE_PARAMETERS_START(1, 2)
- Z_PARAM_OBJECT_OF_CLASS(object, reflector_ptr)
- Z_PARAM_OPTIONAL
- Z_PARAM_BOOL(return_output)
- ZEND_PARSE_PARAMETERS_END();
-
- reflection_export_impl(return_value, object, return_output);
-}
-/* }}} */
-
/* {{{ proto public static array Reflection::getModifierNames(int modifiers)
Returns an array of modifier names */
-ZEND_METHOD(reflection, getModifierNames)
+ZEND_METHOD(Reflection, getModifierNames)
{
zend_long modifiers;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &modifiers) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1470,17 +1353,9 @@ ZEND_METHOD(reflection, getModifierNames)
}
/* }}} */
-/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return])
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_function, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_function_ptr, 1);
-}
-/* }}} */
-
/* {{{ proto public void ReflectionFunction::__construct(string name)
Constructor. Throws an Exception in case the given function does not exist */
-ZEND_METHOD(reflection_function, __construct)
+ZEND_METHOD(ReflectionFunction, __construct)
{
zval *object;
zval *closure = NULL;
@@ -1497,8 +1372,8 @@ ZEND_METHOD(reflection_function, __construct)
} else {
ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "S", &fname) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &fname) == FAILURE) {
+ RETURN_THROWS();
}
if (UNEXPECTED(ZSTR_VAL(fname)[0] == '\\')) {
@@ -1516,7 +1391,7 @@ ZEND_METHOD(reflection_function, __construct)
if (fptr == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Function %s() does not exist", ZSTR_VAL(fname));
- return;
+ RETURN_THROWS();
}
}
@@ -1534,14 +1409,14 @@ ZEND_METHOD(reflection_function, __construct)
/* {{{ proto public string ReflectionFunction::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_function, __toString)
+ZEND_METHOD(ReflectionFunction, __toString)
{
reflection_object *intern;
zend_function *fptr;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
_function_string(&str, fptr, intern->ce, "");
@@ -1551,24 +1426,29 @@ ZEND_METHOD(reflection_function, __toString)
/* {{{ proto public string ReflectionFunction::getName()
Returns this function's name */
-ZEND_METHOD(reflection_function, getName)
+ZEND_METHOD(ReflectionFunctionAbstract, getName)
{
+ reflection_object *intern;
+ zend_function *fptr;
+
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- _default_get_name(ZEND_THIS, return_value);
+
+ GET_REFLECTION_OBJECT_PTR(fptr);
+ RETURN_STR_COPY(fptr->common.function_name);
}
/* }}} */
/* {{{ proto public bool ReflectionFunction::isClosure()
Returns whether this is a closure */
-ZEND_METHOD(reflection_function, isClosure)
+ZEND_METHOD(ReflectionFunctionAbstract, isClosure)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->common.fn_flags & ZEND_ACC_CLOSURE);
@@ -1577,13 +1457,13 @@ ZEND_METHOD(reflection_function, isClosure)
/* {{{ proto public bool ReflectionFunction::getClosureThis()
Returns this pointer bound to closure */
-ZEND_METHOD(reflection_function, getClosureThis)
+ZEND_METHOD(ReflectionFunctionAbstract, getClosureThis)
{
reflection_object *intern;
zval* closure_this;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT();
if (!Z_ISUNDEF(intern->obj)) {
@@ -1598,13 +1478,13 @@ ZEND_METHOD(reflection_function, getClosureThis)
/* {{{ proto public ReflectionClass ReflectionFunction::getClosureScopeClass()
Returns the scope associated to the closure */
-ZEND_METHOD(reflection_function, getClosureScopeClass)
+ZEND_METHOD(ReflectionFunctionAbstract, getClosureScopeClass)
{
reflection_object *intern;
const zend_function *closure_func;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT();
if (!Z_ISUNDEF(intern->obj)) {
@@ -1618,13 +1498,13 @@ ZEND_METHOD(reflection_function, getClosureScopeClass)
/* {{{ proto public mixed ReflectionFunction::getClosure()
Returns a dynamically created closure for the function */
-ZEND_METHOD(reflection_function, getClosure)
+ZEND_METHOD(ReflectionFunction, getClosure)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -1640,13 +1520,13 @@ ZEND_METHOD(reflection_function, getClosure)
/* {{{ proto public bool ReflectionFunction::isInternal()
Returns whether this is an internal function */
-ZEND_METHOD(reflection_function, isInternal)
+ZEND_METHOD(ReflectionFunctionAbstract, isInternal)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
@@ -1655,13 +1535,13 @@ ZEND_METHOD(reflection_function, isInternal)
/* {{{ proto public bool ReflectionFunction::isUserDefined()
Returns whether this is a user-defined function */
-ZEND_METHOD(reflection_function, isUserDefined)
+ZEND_METHOD(ReflectionFunctionAbstract, isUserDefined)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
@@ -1670,25 +1550,30 @@ ZEND_METHOD(reflection_function, isUserDefined)
/* {{{ proto public bool ReflectionFunction::isDisabled()
Returns whether this function has been disabled or not */
-ZEND_METHOD(reflection_function, isDisabled)
+ZEND_METHOD(ReflectionFunction, isDisabled)
{
reflection_object *intern;
zend_function *fptr;
GET_REFLECTION_OBJECT_PTR(fptr);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION && fptr->internal_function.handler == zif_display_disabled_function);
}
/* }}} */
/* {{{ proto public string ReflectionFunction::getFileName()
Returns the filename of the file this function was declared in */
-ZEND_METHOD(reflection_function, getFileName)
+ZEND_METHOD(ReflectionFunctionAbstract, getFileName)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
@@ -1700,13 +1585,13 @@ ZEND_METHOD(reflection_function, getFileName)
/* {{{ proto public int ReflectionFunction::getStartLine()
Returns the line this function's declaration starts at */
-ZEND_METHOD(reflection_function, getStartLine)
+ZEND_METHOD(ReflectionFunctionAbstract, getStartLine)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
@@ -1718,13 +1603,13 @@ ZEND_METHOD(reflection_function, getStartLine)
/* {{{ proto public int ReflectionFunction::getEndLine()
Returns the line this function's declaration ends at */
-ZEND_METHOD(reflection_function, getEndLine)
+ZEND_METHOD(ReflectionFunctionAbstract, getEndLine)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
@@ -1736,13 +1621,13 @@ ZEND_METHOD(reflection_function, getEndLine)
/* {{{ proto public string ReflectionFunction::getDocComment()
Returns the doc comment for this function */
-ZEND_METHOD(reflection_function, getDocComment)
+ZEND_METHOD(ReflectionFunctionAbstract, getDocComment)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
@@ -1754,14 +1639,14 @@ ZEND_METHOD(reflection_function, getDocComment)
/* {{{ proto public array ReflectionFunction::getStaticVariables()
Returns an associative array containing this function's static variables and their values */
-ZEND_METHOD(reflection_function, getStaticVariables)
+ZEND_METHOD(ReflectionFunctionAbstract, getStaticVariables)
{
reflection_object *intern;
zend_function *fptr;
zval *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -1790,7 +1675,7 @@ ZEND_METHOD(reflection_function, getStaticVariables)
/* {{{ proto public mixed ReflectionFunction::invoke([mixed* args])
Invokes the function */
-ZEND_METHOD(reflection_function, invoke)
+ZEND_METHOD(ReflectionFunction, invoke)
{
zval retval;
zval *params = NULL;
@@ -1803,7 +1688,7 @@ ZEND_METHOD(reflection_function, invoke)
GET_REFLECTION_OBJECT_PTR(fptr);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &params, &num_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fci.size = sizeof(fci);
@@ -1820,7 +1705,7 @@ ZEND_METHOD(reflection_function, invoke)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0);
}
result = zend_call_function(&fci, &fcc);
@@ -1828,7 +1713,7 @@ ZEND_METHOD(reflection_function, invoke)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
@@ -1842,7 +1727,7 @@ ZEND_METHOD(reflection_function, invoke)
/* {{{ proto public mixed ReflectionFunction::invokeArgs(array args)
Invokes the function and pass its arguments as array. */
-ZEND_METHOD(reflection_function, invokeArgs)
+ZEND_METHOD(ReflectionFunction, invokeArgs)
{
zval retval;
zval *params, *val;
@@ -1857,7 +1742,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
GET_REFLECTION_OBJECT_PTR(fptr);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &param_array) == FAILURE) {
- return;
+ RETURN_THROWS();
}
argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
@@ -1883,7 +1768,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0);
}
result = zend_call_function(&fci, &fcc);
@@ -1896,7 +1781,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
@@ -1910,20 +1795,24 @@ ZEND_METHOD(reflection_function, invokeArgs)
/* {{{ proto public bool ReflectionFunction::returnsReference()
Gets whether this function returns a reference */
-ZEND_METHOD(reflection_function, returnsReference)
+ZEND_METHOD(ReflectionFunctionAbstract, returnsReference)
{
reflection_object *intern;
zend_function *fptr;
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_BOOL((fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0);
}
/* }}} */
/* {{{ proto public bool ReflectionFunction::getNumberOfParameters()
Gets the number of parameters */
-ZEND_METHOD(reflection_function, getNumberOfParameters)
+ZEND_METHOD(ReflectionFunctionAbstract, getNumberOfParameters)
{
reflection_object *intern;
zend_function *fptr;
@@ -1931,6 +1820,10 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
num_args = fptr->common.num_args;
if (fptr->common.fn_flags & ZEND_ACC_VARIADIC) {
num_args++;
@@ -1942,20 +1835,24 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
/* {{{ proto public bool ReflectionFunction::getNumberOfRequiredParameters()
Gets the number of required parameters */
-ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
+ZEND_METHOD(ReflectionFunctionAbstract, getNumberOfRequiredParameters)
{
reflection_object *intern;
zend_function *fptr;
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_LONG(fptr->common.required_num_args);
}
/* }}} */
/* {{{ proto public ReflectionParameter[] ReflectionFunction::getParameters()
Returns an array of parameter objects for this function */
-ZEND_METHOD(reflection_function, getParameters)
+ZEND_METHOD(ReflectionFunctionAbstract, getParameters)
{
reflection_object *intern;
zend_function *fptr;
@@ -1964,6 +1861,10 @@ ZEND_METHOD(reflection_function, getParameters)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
arg_info= fptr->common.arg_info;
num_args = fptr->common.num_args;
if (fptr->common.fn_flags & ZEND_ACC_VARIADIC) {
@@ -1995,7 +1896,7 @@ ZEND_METHOD(reflection_function, getParameters)
/* {{{ proto public ReflectionExtension|NULL ReflectionFunction::getExtension()
Returns NULL or the extension the function belongs to */
-ZEND_METHOD(reflection_function, getExtension)
+ZEND_METHOD(ReflectionFunctionAbstract, getExtension)
{
reflection_object *intern;
zend_function *fptr;
@@ -2003,6 +1904,10 @@ ZEND_METHOD(reflection_function, getExtension)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (fptr->type != ZEND_INTERNAL_FUNCTION) {
RETURN_NULL();
}
@@ -2018,7 +1923,7 @@ ZEND_METHOD(reflection_function, getExtension)
/* {{{ proto public string|false ReflectionFunction::getExtensionName()
Returns false or the name of the extension the function belongs to */
-ZEND_METHOD(reflection_function, getExtensionName)
+ZEND_METHOD(ReflectionFunctionAbstract, getExtensionName)
{
reflection_object *intern;
zend_function *fptr;
@@ -2026,6 +1931,10 @@ ZEND_METHOD(reflection_function, getExtensionName)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (fptr->type != ZEND_INTERNAL_FUNCTION) {
RETURN_FALSE;
}
@@ -2040,7 +1949,7 @@ ZEND_METHOD(reflection_function, getExtensionName)
/* }}} */
/* {{{ proto public void ReflectionGenerator::__construct(object Generator) */
-ZEND_METHOD(reflection_generator, __construct)
+ZEND_METHOD(ReflectionGenerator, __construct)
{
zval *generator, *object;
reflection_object *intern;
@@ -2049,14 +1958,14 @@ ZEND_METHOD(reflection_generator, __construct)
object = ZEND_THIS;
intern = Z_REFLECTION_P(object);
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) {
+ RETURN_THROWS();
}
ex = ((zend_generator *) Z_OBJ_P(generator))->execute_data;
if (!ex) {
_DO_THROW("Cannot create ReflectionGenerator based on a terminated Generator");
- return;
+ RETURN_THROWS();
}
intern->ref_type = REF_TYPE_GENERATOR;
@@ -2069,11 +1978,11 @@ ZEND_METHOD(reflection_generator, __construct)
#define REFLECTION_CHECK_VALID_GENERATOR(ex) \
if (!ex) { \
_DO_THROW("Cannot fetch information from a terminated Generator"); \
- return; \
+ RETURN_THROWS(); \
}
/* {{{ proto public array ReflectionGenerator::getTrace($options = DEBUG_BACKTRACE_PROVIDE_OBJECT) */
-ZEND_METHOD(reflection_generator, getTrace)
+ZEND_METHOD(ReflectionGenerator, getTrace)
{
zend_long options = DEBUG_BACKTRACE_PROVIDE_OBJECT;
zend_generator *generator = (zend_generator *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
@@ -2083,7 +1992,7 @@ ZEND_METHOD(reflection_generator, getTrace)
zend_execute_data *root_prev = NULL, *cur_prev;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2109,13 +2018,13 @@ ZEND_METHOD(reflection_generator, getTrace)
/* }}} */
/* {{{ proto public int ReflectionGenerator::getExecutingLine() */
-ZEND_METHOD(reflection_generator, getExecutingLine)
+ZEND_METHOD(ReflectionGenerator, getExecutingLine)
{
zend_generator *generator = (zend_generator *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2125,13 +2034,13 @@ ZEND_METHOD(reflection_generator, getExecutingLine)
/* }}} */
/* {{{ proto public string ReflectionGenerator::getExecutingFile() */
-ZEND_METHOD(reflection_generator, getExecutingFile)
+ZEND_METHOD(ReflectionGenerator, getExecutingFile)
{
zend_generator *generator = (zend_generator *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2141,13 +2050,13 @@ ZEND_METHOD(reflection_generator, getExecutingFile)
/* }}} */
/* {{{ proto public ReflectionFunctionAbstract ReflectionGenerator::getFunction() */
-ZEND_METHOD(reflection_generator, getFunction)
+ZEND_METHOD(ReflectionGenerator, getFunction)
{
zend_generator *generator = (zend_generator *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2165,13 +2074,13 @@ ZEND_METHOD(reflection_generator, getFunction)
/* }}} */
/* {{{ proto public object ReflectionGenerator::getThis() */
-ZEND_METHOD(reflection_generator, getThis)
+ZEND_METHOD(ReflectionGenerator, getThis)
{
zend_generator *generator = (zend_generator *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2186,14 +2095,14 @@ ZEND_METHOD(reflection_generator, getThis)
/* }}} */
/* {{{ proto public Generator ReflectionGenerator::getExecutingGenerator() */
-ZEND_METHOD(reflection_generator, getExecutingGenerator)
+ZEND_METHOD(ReflectionGenerator, getExecutingGenerator)
{
zend_generator *generator = (zend_generator *) Z_OBJ(Z_REFLECTION_P(ZEND_THIS)->obj);
zend_execute_data *ex = generator->execute_data;
zend_generator *current;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2205,17 +2114,9 @@ ZEND_METHOD(reflection_generator, getExecutingGenerator)
}
/* }}} */
-/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_parameter, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_parameter_ptr, 2);
-}
-/* }}} */
-
/* {{{ proto public void ReflectionParameter::__construct(mixed function, mixed parameter)
Constructor. Throws an Exception in case the given method does not exist */
-ZEND_METHOD(reflection_parameter, __construct)
+ZEND_METHOD(ReflectionParameter, __construct)
{
parameter_reference *ref;
zval *reference, *parameter;
@@ -2229,8 +2130,8 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_class_entry *ce = NULL;
zend_bool is_closure = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zz", &reference, &parameter) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &reference, &parameter) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -2246,7 +2147,7 @@ ZEND_METHOD(reflection_parameter, __construct)
if (!fptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Function %s() does not exist", Z_STRVAL_P(reference));
- return;
+ RETURN_THROWS();
}
ce = fptr->common.scope;
}
@@ -2261,7 +2162,7 @@ ZEND_METHOD(reflection_parameter, __construct)
|| ((method = zend_hash_index_find(Z_ARRVAL_P(reference), 1)) == NULL))
{
_DO_THROW("Expected array($object, $method) or array($classname, $method)");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(classref) == IS_OBJECT) {
@@ -2275,7 +2176,7 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", ZSTR_VAL(name));
zend_string_release(name);
- return;
+ RETURN_THROWS();
}
zend_string_release(name);
}
@@ -2296,7 +2197,7 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_string_release(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method));
- return;
+ RETURN_THROWS();
}
zend_string_release(name);
zend_string_release(lcname);
@@ -2313,14 +2214,14 @@ ZEND_METHOD(reflection_parameter, __construct)
} else if ((fptr = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZEND_INVOKE_FUNC_NAME);
- return;
+ RETURN_THROWS();
}
}
break;
default:
- _DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object");
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be either a string, an array(class, method) or a callable object, %s given", zend_zval_type_name(reference));
+ RETURN_THROWS();
}
/* Now, search for the parameter */
@@ -2343,8 +2244,7 @@ ZEND_METHOD(reflection_parameter, __construct)
goto failure;
}
- if (fptr->type == ZEND_INTERNAL_FUNCTION &&
- !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) {
+ if (has_internal_arg_info(fptr)) {
for (i = 0; i < num_args; i++) {
if (arg_info[i].name) {
if (strcmp(((zend_internal_arg_info*)arg_info)[i].name, Z_STRVAL_P(parameter)) == 0) {
@@ -2384,23 +2284,16 @@ ZEND_METHOD(reflection_parameter, __construct)
}
prop_name = reflection_prop_name(object);
- if (arg_info[position].name) {
- if (fptr->type == ZEND_INTERNAL_FUNCTION &&
- !(fptr->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) {
- ZVAL_STRING(prop_name, ((zend_internal_arg_info*)arg_info)[position].name);
- } else {
- ZVAL_STR_COPY(prop_name, arg_info[position].name);
- }
+ if (has_internal_arg_info(fptr)) {
+ ZVAL_STRING(prop_name, ((zend_internal_arg_info*)arg_info)[position].name);
} else {
- ZVAL_NULL(prop_name);
+ ZVAL_STR_COPY(prop_name, arg_info[position].name);
}
return;
failure:
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
- if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- zend_string_release_ex(fptr->common.function_name, 0);
- }
+ zend_string_release_ex(fptr->common.function_name, 0);
zend_free_trampoline(fptr);
}
if (is_closure) {
@@ -2411,14 +2304,14 @@ failure:
/* {{{ proto public string ReflectionParameter::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_parameter, __toString)
+ZEND_METHOD(ReflectionParameter, __toString)
{
reflection_object *intern;
parameter_reference *param;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "");
@@ -2429,24 +2322,33 @@ ZEND_METHOD(reflection_parameter, __toString)
/* {{{ proto public string ReflectionParameter::getName()
Returns this parameters's name */
-ZEND_METHOD(reflection_parameter, getName)
+ZEND_METHOD(ReflectionParameter, getName)
{
+ reflection_object *intern;
+ parameter_reference *param;
+
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
+ }
+
+ GET_REFLECTION_OBJECT_PTR(param);
+ if (has_internal_arg_info(param->fptr)) {
+ RETURN_STRING(((zend_internal_arg_info *) param->arg_info)->name);
+ } else {
+ RETURN_STR_COPY(param->arg_info->name);
}
- _default_get_name(ZEND_THIS, return_value);
}
/* }}} */
/* {{{ proto public ReflectionFunction ReflectionParameter::getDeclaringFunction()
Returns the ReflectionFunction for the function of this parameter */
-ZEND_METHOD(reflection_parameter, getDeclaringFunction)
+ZEND_METHOD(ReflectionParameter, getDeclaringFunction)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2460,13 +2362,13 @@ ZEND_METHOD(reflection_parameter, getDeclaringFunction)
/* {{{ proto public ReflectionClass|NULL ReflectionParameter::getDeclaringClass()
Returns in which class this parameter is defined (not the type of the parameter) */
-ZEND_METHOD(reflection_parameter, getDeclaringClass)
+ZEND_METHOD(ReflectionParameter, getDeclaringClass)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2478,18 +2380,19 @@ ZEND_METHOD(reflection_parameter, getDeclaringClass)
/* {{{ proto public ReflectionClass|NULL ReflectionParameter::getClass()
Returns this parameters's class hint or NULL if there is none */
-ZEND_METHOD(reflection_parameter, getClass)
+ZEND_METHOD(ReflectionParameter, getClass)
{
reflection_object *intern;
parameter_reference *param;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- if (ZEND_TYPE_IS_CLASS(param->arg_info->type)) {
+ // TODO: This is going to return null for union types, which is rather odd.
+ if (ZEND_TYPE_HAS_NAME(param->arg_info->type)) {
/* Class name is stored as a string, we might also get "self" or "parent"
* - For "self", simply use the function scope. If scope is NULL then
* the function is global and thus self does not make any sense
@@ -2510,19 +2413,19 @@ ZEND_METHOD(reflection_parameter, getClass)
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'self' as type hint but function is not a class member!");
- return;
+ RETURN_THROWS();
}
} else if (0 == zend_binary_strcasecmp(ZSTR_VAL(class_name), ZSTR_LEN(class_name), "parent", sizeof("parent")- 1)) {
ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'parent' as type hint but function is not a class member!");
- return;
+ RETURN_THROWS();
}
if (!ce->parent) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'parent' as type hint although class does not have a parent!");
- return;
+ RETURN_THROWS();
}
ce = ce->parent;
} else {
@@ -2530,7 +2433,7 @@ ZEND_METHOD(reflection_parameter, getClass)
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", ZSTR_VAL(class_name));
- return;
+ RETURN_THROWS();
}
}
zend_reflection_class_factory(ce, return_value);
@@ -2540,13 +2443,13 @@ ZEND_METHOD(reflection_parameter, getClass)
/* {{{ proto public bool ReflectionParameter::hasType()
Returns whether parameter has a type */
-ZEND_METHOD(reflection_parameter, hasType)
+ZEND_METHOD(ReflectionParameter, hasType)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2556,113 +2459,118 @@ ZEND_METHOD(reflection_parameter, hasType)
/* {{{ proto public ReflectionType ReflectionParameter::getType()
Returns the type associated with the parameter */
-ZEND_METHOD(reflection_parameter, getType)
+ZEND_METHOD(ReflectionParameter, getType)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
if (!ZEND_TYPE_IS_SET(param->arg_info->type)) {
RETURN_NULL();
}
- reflection_type_factory(param->arg_info->type, return_value);
+ reflection_type_factory(param->arg_info->type, return_value, 1);
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::isArray()
Returns whether parameter MUST be an array */
-ZEND_METHOD(reflection_parameter, isArray)
+ZEND_METHOD(ReflectionParameter, isArray)
{
reflection_object *intern;
parameter_reference *param;
+ uint32_t type_mask;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_ARRAY);
+ type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(type_mask == MAY_BE_ARRAY);
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::isCallable()
Returns whether parameter MUST be callable */
-ZEND_METHOD(reflection_parameter, isCallable)
+ZEND_METHOD(ReflectionParameter, isCallable)
{
reflection_object *intern;
parameter_reference *param;
+ uint32_t type_mask;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_CALLABLE);
+ type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(type_mask == MAY_BE_CALLABLE);
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::allowsNull()
Returns whether NULL is allowed as this parameters's value */
-ZEND_METHOD(reflection_parameter, allowsNull)
+ZEND_METHOD(ReflectionParameter, allowsNull)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_ALLOW_NULL(param->arg_info->type));
+ RETVAL_BOOL(!ZEND_TYPE_IS_SET(param->arg_info->type)
+ || ZEND_TYPE_ALLOW_NULL(param->arg_info->type));
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::isPassedByReference()
Returns whether this parameters is passed to by reference */
-ZEND_METHOD(reflection_parameter, isPassedByReference)
+ZEND_METHOD(ReflectionParameter, isPassedByReference)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(param->arg_info->pass_by_reference);
+ RETVAL_BOOL(ZEND_ARG_SEND_MODE(param->arg_info));
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::canBePassedByValue()
Returns whether this parameter can be passed by value */
-ZEND_METHOD(reflection_parameter, canBePassedByValue)
+ZEND_METHOD(ReflectionParameter, canBePassedByValue)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
/* true if it's ZEND_SEND_BY_VAL or ZEND_SEND_PREFER_REF */
- RETVAL_BOOL(param->arg_info->pass_by_reference != ZEND_SEND_BY_REF);
+ RETVAL_BOOL(ZEND_ARG_SEND_MODE(param->arg_info) != ZEND_SEND_BY_REF);
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::getPosition()
Returns whether this parameter is an optional parameter */
-ZEND_METHOD(reflection_parameter, getPosition)
+ZEND_METHOD(ReflectionParameter, getPosition)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2672,13 +2580,13 @@ ZEND_METHOD(reflection_parameter, getPosition)
/* {{{ proto public bool ReflectionParameter::isOptional()
Returns whether this parameter is an optional parameter */
-ZEND_METHOD(reflection_parameter, isOptional)
+ZEND_METHOD(ReflectionParameter, isOptional)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2688,52 +2596,45 @@ ZEND_METHOD(reflection_parameter, isOptional)
/* {{{ proto public bool ReflectionParameter::isDefaultValueAvailable()
Returns whether the default value of this parameter is available */
-ZEND_METHOD(reflection_parameter, isDefaultValueAvailable)
+ZEND_METHOD(ReflectionParameter, isDefaultValueAvailable)
{
reflection_object *intern;
parameter_reference *param;
- zend_op *precv;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- GET_REFLECTION_OBJECT_PTR(param);
- if (param->fptr->type != ZEND_USER_FUNCTION)
- {
- RETURN_FALSE;
- }
+ GET_REFLECTION_OBJECT_PTR(param);
- precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
- if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) {
- RETURN_FALSE;
+ if (param->fptr->type == ZEND_INTERNAL_FUNCTION) {
+ RETURN_BOOL(((zend_internal_arg_info*) (param->arg_info))->default_value);
+ } else {
+ zval *default_value = get_default_from_recv((zend_op_array *)param->fptr, param->offset);
+ RETURN_BOOL(default_value != NULL);
}
- RETURN_TRUE;
}
/* }}} */
/* {{{ proto public bool ReflectionParameter::getDefaultValue()
Returns the default value of this parameter or throws an exception */
-ZEND_METHOD(reflection_parameter, getDefaultValue)
+ZEND_METHOD(ReflectionParameter, getDefaultValue)
{
+ reflection_object *intern;
parameter_reference *param;
- zend_op *precv;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!param) {
- return;
- }
+ GET_REFLECTION_OBJECT_PTR(param);
- precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
- if (!precv) {
- return;
+ if (get_parameter_default(return_value, param) == FAILURE) {
+ zend_throw_exception_ex(reflection_exception_ptr, 0,
+ "Internal error: Failed to retrieve the default value");
+ RETURN_THROWS();
}
- ZVAL_COPY(return_value, RT_CONSTANT(precv, precv->op2));
if (Z_TYPE_P(return_value) == IS_CONSTANT_AST) {
zval_update_constant_ex(return_value, param->fptr->common.scope);
}
@@ -2742,88 +2643,95 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
/* {{{ proto public bool ReflectionParameter::isDefaultValueConstant()
Returns whether the default value of this parameter is constant */
-ZEND_METHOD(reflection_parameter, isDefaultValueConstant)
+ZEND_METHOD(ReflectionParameter, isDefaultValueConstant)
{
- zend_op *precv;
+ reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!param) {
- RETURN_FALSE;
- }
-
- precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
- if (precv && Z_TYPE_P(RT_CONSTANT(precv, precv->op2)) == IS_CONSTANT_AST) {
- zend_ast *ast = Z_ASTVAL_P(RT_CONSTANT(precv, precv->op2));
+ GET_REFLECTION_OBJECT_PTR(param);
- if (ast->kind == ZEND_AST_CONSTANT
- || ast->kind == ZEND_AST_CONSTANT_CLASS) {
- RETURN_TRUE;
- }
+ zval default_value;
+ if (get_parameter_default(&default_value, param) == FAILURE) {
+ zend_throw_exception_ex(reflection_exception_ptr, 0,
+ "Internal error: Failed to retrieve the default value");
+ RETURN_THROWS();
}
- RETURN_FALSE;
+ if (Z_TYPE(default_value) == IS_CONSTANT_AST) {
+ zend_ast *ast = Z_ASTVAL(default_value);
+ RETVAL_BOOL(ast->kind == ZEND_AST_CONSTANT || ast->kind == ZEND_AST_CONSTANT_CLASS);
+ zval_ptr_dtor_nogc(&default_value);
+ } else {
+ RETURN_FALSE;
+ }
}
/* }}} */
/* {{{ proto public mixed ReflectionParameter::getDefaultValueConstantName()
Returns the default value's constant name if default value is constant or null */
-ZEND_METHOD(reflection_parameter, getDefaultValueConstantName)
+ZEND_METHOD(ReflectionParameter, getDefaultValueConstantName)
{
- zend_op *precv;
+ reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!param) {
- return;
+ GET_REFLECTION_OBJECT_PTR(param);
+
+ zval default_value;
+ if (get_parameter_default(&default_value, param) == FAILURE) {
+ zend_throw_exception_ex(reflection_exception_ptr, 0,
+ "Internal error: Failed to retrieve the default value");
+ RETURN_THROWS();
}
- precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param);
- if (precv && Z_TYPE_P(RT_CONSTANT(precv, precv->op2)) == IS_CONSTANT_AST) {
- zend_ast *ast = Z_ASTVAL_P(RT_CONSTANT(precv, precv->op2));
+ if (Z_TYPE(default_value) != IS_CONSTANT_AST) {
+ zval_ptr_dtor_nogc(&default_value);
+ RETURN_NULL();
+ }
- if (ast->kind == ZEND_AST_CONSTANT) {
- RETURN_STR_COPY(zend_ast_get_constant_name(ast));
- } else if (ast->kind == ZEND_AST_CONSTANT_CLASS) {
- RETURN_STRINGL("__CLASS__", sizeof("__CLASS__")-1);
- }
+ zend_ast *ast = Z_ASTVAL(default_value);
+ if (ast->kind == ZEND_AST_CONSTANT) {
+ RETVAL_STR_COPY(zend_ast_get_constant_name(ast));
+ } else if (ast->kind == ZEND_AST_CONSTANT_CLASS) {
+ RETVAL_STRINGL("__CLASS__", sizeof("__CLASS__")-1);
+ } else {
+ RETVAL_NULL();
}
+ zval_ptr_dtor_nogc(&default_value);
}
-/* }}} */
/* {{{ proto public bool ReflectionParameter::isVariadic()
Returns whether this parameter is a variadic parameter */
-ZEND_METHOD(reflection_parameter, isVariadic)
+ZEND_METHOD(ReflectionParameter, isVariadic)
{
reflection_object *intern;
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(param->arg_info->is_variadic);
+ RETVAL_BOOL(ZEND_ARG_IS_VARIADIC(param->arg_info));
}
/* }}} */
/* {{{ proto public bool ReflectionType::allowsNull()
Returns whether parameter MAY be null */
-ZEND_METHOD(reflection_type, allowsNull)
+ZEND_METHOD(ReflectionType, allowsNull)
{
reflection_object *intern;
type_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2831,78 +2739,138 @@ ZEND_METHOD(reflection_type, allowsNull)
}
/* }}} */
-/* {{{ proto public bool ReflectionType::isBuiltin()
- Returns whether parameter is a builtin type */
-ZEND_METHOD(reflection_type, isBuiltin)
+static zend_string *zend_type_to_string_without_null(zend_type type) {
+ ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL;
+ return zend_type_to_string(type);
+}
+
+/* {{{ proto public string ReflectionType::__toString()
+ Return the text of the type hint */
+ZEND_METHOD(ReflectionType, __toString)
{
reflection_object *intern;
type_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type));
+ RETURN_STR(zend_type_to_string(param->type));
}
/* }}} */
-/* {{{ reflection_type_name */
-static zend_string *reflection_type_name(type_reference *param) {
- if (ZEND_TYPE_IS_NAME(param->type)) {
- return zend_string_copy(ZEND_TYPE_NAME(param->type));
- } else if (ZEND_TYPE_IS_CE(param->type)) {
- return zend_string_copy(ZEND_TYPE_CE(param->type)->name);
- } else {
- char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->type));
- return zend_string_init(name, strlen(name), 0);
+/* {{{ proto public string ReflectionNamedType::getName()
+ Return the name of the type */
+ZEND_METHOD(ReflectionNamedType, getName)
+{
+ reflection_object *intern;
+ type_reference *param;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
+ GET_REFLECTION_OBJECT_PTR(param);
+
+ if (param->legacy_behavior) {
+ RETURN_STR(zend_type_to_string_without_null(param->type));
+ }
+ RETURN_STR(zend_type_to_string(param->type));
}
/* }}} */
-/* {{{ proto public string ReflectionType::__toString()
- Return the text of the type hint */
-ZEND_METHOD(reflection_type, __toString)
+/* {{{ proto public bool ReflectionNamedType::isBuiltin()
+ Returns whether type is a builtin type */
+ZEND_METHOD(ReflectionNamedType, isBuiltin)
{
reflection_object *intern;
type_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ /* Treat "static" as a class type for the purposes of reflection. */
+ RETVAL_BOOL(ZEND_TYPE_IS_ONLY_MASK(param->type)
+ && !(ZEND_TYPE_FULL_MASK(param->type) & MAY_BE_STATIC));
}
/* }}} */
-/* {{{ proto public string ReflectionNamedType::getName()
- Return the text of the type hint */
-ZEND_METHOD(reflection_named_type, getName)
+static void append_type(zval *return_value, zend_type type) {
+ zval reflection_type;
+ reflection_type_factory(type, &reflection_type, 0);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &reflection_type);
+}
+
+static void append_type_mask(zval *return_value, uint32_t type_mask) {
+ append_type(return_value, (zend_type) ZEND_TYPE_INIT_MASK(type_mask));
+}
+
+/* {{{ proto public string ReflectionUnionType::getTypes()
+ Returns the types that are part of this union type */
+ZEND_METHOD(ReflectionUnionType, getTypes)
{
reflection_object *intern;
type_reference *param;
+ uint32_t type_mask;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
-}
-/* }}} */
+ array_init(return_value);
+ if (ZEND_TYPE_HAS_LIST(param->type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(param->type), list_type) {
+ append_type(return_value, *list_type);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(param->type)) {
+ append_type(return_value,
+ (zend_type) ZEND_TYPE_INIT_CLASS(ZEND_TYPE_NAME(param->type), 0, 0));
+ } else if (ZEND_TYPE_HAS_CE(param->type)) {
+ append_type(return_value,
+ (zend_type) ZEND_TYPE_INIT_CE(ZEND_TYPE_CE(param->type), 0, 0));
+ }
-/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_method, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_method_ptr, 2);
+ type_mask = ZEND_TYPE_PURE_MASK(param->type);
+ ZEND_ASSERT(!(type_mask & MAY_BE_VOID));
+ if (type_mask & MAY_BE_CALLABLE) {
+ append_type_mask(return_value, MAY_BE_CALLABLE);
+ }
+ if (type_mask & MAY_BE_ITERABLE) {
+ append_type_mask(return_value, MAY_BE_ITERABLE);
+ }
+ if (type_mask & MAY_BE_OBJECT) {
+ append_type_mask(return_value, MAY_BE_OBJECT);
+ }
+ if (type_mask & MAY_BE_ARRAY) {
+ append_type_mask(return_value, MAY_BE_ARRAY);
+ }
+ if (type_mask & MAY_BE_STRING) {
+ append_type_mask(return_value, MAY_BE_STRING);
+ }
+ if (type_mask & MAY_BE_LONG) {
+ append_type_mask(return_value, MAY_BE_LONG);
+ }
+ if (type_mask & MAY_BE_DOUBLE) {
+ append_type_mask(return_value, MAY_BE_DOUBLE);
+ }
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL) {
+ append_type_mask(return_value, MAY_BE_BOOL);
+ } else if (type_mask & MAY_BE_FALSE) {
+ append_type_mask(return_value, MAY_BE_FALSE);
+ }
+ if (type_mask & MAY_BE_NULL) {
+ append_type_mask(return_value, MAY_BE_NULL);
+ }
}
/* }}} */
/* {{{ proto public void ReflectionMethod::__construct(mixed class_or_method [, string name])
Constructor. Throws an Exception in case the given method does not exist */
-ZEND_METHOD(reflection_method, __construct)
+ZEND_METHOD(ReflectionMethod, __construct)
{
zval *classname;
zval *object, *orig_obj;
@@ -2915,14 +2883,13 @@ ZEND_METHOD(reflection_method, __construct)
zval ztmp;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "zs", &classname, &name_str, &name_len) == FAILURE) {
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
if ((tmp = strstr(name_str, "::")) == NULL) {
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invalid method name %s", name_str);
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be a valid method name");
+ RETURN_THROWS();
}
classname = &ztmp;
tmp_len = tmp - name_str;
@@ -2950,7 +2917,7 @@ ZEND_METHOD(reflection_method, __construct)
if (classname == &ztmp) {
zval_ptr_dtor_str(&ztmp);
}
- return;
+ RETURN_THROWS();
}
break;
@@ -2962,8 +2929,8 @@ ZEND_METHOD(reflection_method, __construct)
if (classname == &ztmp) {
zval_ptr_dtor_str(&ztmp);
}
- _DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname));
+ RETURN_THROWS();
}
if (classname == &ztmp) {
@@ -2981,7 +2948,7 @@ ZEND_METHOD(reflection_method, __construct)
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str);
- return;
+ RETURN_THROWS();
}
efree(lcname);
@@ -2995,14 +2962,14 @@ ZEND_METHOD(reflection_method, __construct)
/* {{{ proto public string ReflectionMethod::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_method, __toString)
+ZEND_METHOD(ReflectionMethod, __toString)
{
reflection_object *intern;
zend_function *mptr;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
_function_string(&str, mptr, intern->ce, "");
@@ -3012,7 +2979,7 @@ ZEND_METHOD(reflection_method, __toString)
/* {{{ proto public mixed ReflectionMethod::getClosure([mixed object])
Invokes the function */
-ZEND_METHOD(reflection_method, getClosure)
+ZEND_METHOD(ReflectionMethod, getClosure)
{
reflection_object *intern;
zval *obj;
@@ -3024,12 +2991,12 @@ ZEND_METHOD(reflection_method, getClosure)
zend_create_fake_closure(return_value, mptr, mptr->common.scope, mptr->common.scope, NULL);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!instanceof_function(Z_OBJCE_P(obj), mptr->common.scope)) {
_DO_THROW("Given object is not an instance of the class this method was declared in");
- return;
+ RETURN_THROWS();
}
/* This is an original closure object and __invoke is to be called. */
@@ -3064,7 +3031,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
@@ -3073,16 +3040,16 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (variadic) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!*", &object, &params, &argc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a", &object, &param_array) == FAILURE) {
- return;
+ RETURN_THROWS();
}
argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
@@ -3109,7 +3076,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke non static method %s::%s() without an object",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
obj_ce = Z_OBJCE_P(object);
@@ -3119,7 +3086,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
efree(params);
}
_DO_THROW("Given object is not an instance of the class this method was declared in");
- return;
+ RETURN_THROWS();
}
}
@@ -3154,7 +3121,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
@@ -3166,9 +3133,9 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
}
/* }}} */
-/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, mixed* args)
+/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, [mixed* args])
Invokes the method. */
-ZEND_METHOD(reflection_method, invoke)
+ZEND_METHOD(ReflectionMethod, invoke)
{
reflection_method_invoke(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
@@ -3176,7 +3143,7 @@ ZEND_METHOD(reflection_method, invoke)
/* {{{ proto public mixed ReflectionMethod::invokeArgs(mixed object, array args)
Invokes the function and pass its arguments as array. */
-ZEND_METHOD(reflection_method, invokeArgs)
+ZEND_METHOD(ReflectionMethod, invokeArgs)
{
reflection_method_invoke(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
@@ -3184,7 +3151,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
/* {{{ proto public bool ReflectionMethod::isFinal()
Returns whether this method is final */
-ZEND_METHOD(reflection_method, isFinal)
+ZEND_METHOD(ReflectionMethod, isFinal)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL);
}
@@ -3192,7 +3159,7 @@ ZEND_METHOD(reflection_method, isFinal)
/* {{{ proto public bool ReflectionMethod::isAbstract()
Returns whether this method is abstract */
-ZEND_METHOD(reflection_method, isAbstract)
+ZEND_METHOD(ReflectionMethod, isAbstract)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_ABSTRACT);
}
@@ -3200,7 +3167,7 @@ ZEND_METHOD(reflection_method, isAbstract)
/* {{{ proto public bool ReflectionMethod::isPublic()
Returns whether this method is public */
-ZEND_METHOD(reflection_method, isPublic)
+ZEND_METHOD(ReflectionMethod, isPublic)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PUBLIC);
}
@@ -3208,7 +3175,7 @@ ZEND_METHOD(reflection_method, isPublic)
/* {{{ proto public bool ReflectionMethod::isPrivate()
Returns whether this method is private */
-ZEND_METHOD(reflection_method, isPrivate)
+ZEND_METHOD(ReflectionMethod, isPrivate)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PRIVATE);
}
@@ -3216,7 +3183,7 @@ ZEND_METHOD(reflection_method, isPrivate)
/* {{{ proto public bool ReflectionMethod::isProtected()
Returns whether this method is protected */
-ZEND_METHOD(reflection_method, isProtected)
+ZEND_METHOD(ReflectionMethod, isProtected)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PROTECTED);
}
@@ -3224,7 +3191,7 @@ ZEND_METHOD(reflection_method, isProtected)
/* {{{ proto public bool ReflectionMethod::isStatic()
Returns whether this method is static */
-ZEND_METHOD(reflection_method, isStatic)
+ZEND_METHOD(ReflectionMethod, isStatic)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_STATIC);
}
@@ -3232,7 +3199,7 @@ ZEND_METHOD(reflection_method, isStatic)
/* {{{ proto public bool ReflectionFunction::isDeprecated()
Returns whether this function is deprecated */
-ZEND_METHOD(reflection_function, isDeprecated)
+ZEND_METHOD(ReflectionFunctionAbstract, isDeprecated)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_DEPRECATED);
}
@@ -3240,7 +3207,7 @@ ZEND_METHOD(reflection_function, isDeprecated)
/* {{{ proto public bool ReflectionFunction::isGenerator()
Returns whether this function is a generator */
-ZEND_METHOD(reflection_function, isGenerator)
+ZEND_METHOD(ReflectionFunctionAbstract, isGenerator)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_GENERATOR);
}
@@ -3248,7 +3215,7 @@ ZEND_METHOD(reflection_function, isGenerator)
/* {{{ proto public bool ReflectionFunction::isVariadic()
Returns whether this function is variadic */
-ZEND_METHOD(reflection_function, isVariadic)
+ZEND_METHOD(ReflectionFunctionAbstract, isVariadic)
{
_function_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_VARIADIC);
}
@@ -3256,45 +3223,40 @@ ZEND_METHOD(reflection_function, isVariadic)
/* {{{ proto public bool ReflectionFunction::inNamespace()
Returns whether this function is defined in namespace */
-ZEND_METHOD(reflection_function, inNamespace)
+ZEND_METHOD(ReflectionFunctionAbstract, inNamespace)
{
- zval *name;
- const char *backslash;
+ reflection_object *intern;
+ zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if ((name = _default_load_name(ZEND_THIS)) == NULL) {
- RETURN_FALSE;
- }
- if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
- && backslash > Z_STRVAL_P(name))
- {
- RETURN_TRUE;
- }
- RETURN_FALSE;
+
+ GET_REFLECTION_OBJECT_PTR(fptr);
+
+ zend_string *name = fptr->common.function_name;
+ const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
+ RETURN_BOOL(backslash && backslash > ZSTR_VAL(name));
}
/* }}} */
/* {{{ proto public string ReflectionFunction::getNamespaceName()
Returns the name of namespace where this function is defined */
-ZEND_METHOD(reflection_function, getNamespaceName)
+ZEND_METHOD(ReflectionFunctionAbstract, getNamespaceName)
{
- zval *name;
- const char *backslash;
+ reflection_object *intern;
+ zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- if ((name = _default_load_name(ZEND_THIS)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
- if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
- && backslash > Z_STRVAL_P(name))
- {
- RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
+
+ GET_REFLECTION_OBJECT_PTR(fptr);
+
+ zend_string *name = fptr->common.function_name;
+ const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
+ if (backslash && backslash > ZSTR_VAL(name)) {
+ RETURN_STRINGL(ZSTR_VAL(name), backslash - ZSTR_VAL(name));
}
RETURN_EMPTY_STRING();
}
@@ -3302,36 +3264,35 @@ ZEND_METHOD(reflection_function, getNamespaceName)
/* {{{ proto public string ReflectionFunction::getShortName()
Returns the short name of the function (without namespace part) */
-ZEND_METHOD(reflection_function, getShortName)
+ZEND_METHOD(ReflectionFunctionAbstract, getShortName)
{
- zval *name;
- const char *backslash;
+ reflection_object *intern;
+ zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if ((name = _default_load_name(ZEND_THIS)) == NULL) {
- RETURN_FALSE;
- }
- if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
- && backslash > Z_STRVAL_P(name))
- {
- RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
+
+ GET_REFLECTION_OBJECT_PTR(fptr);
+
+ zend_string *name = fptr->common.function_name;
+ const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
+ if (backslash && backslash > ZSTR_VAL(name)) {
+ RETURN_STRINGL(backslash + 1, ZSTR_LEN(name) - (backslash - ZSTR_VAL(name) + 1));
}
- ZVAL_COPY_DEREF(return_value, name);
+ RETURN_STR_COPY(name);
}
/* }}} */
/* {{{ proto public bool ReflectionFunctionAbstract:hasReturnType()
Return whether the function has a return type */
-ZEND_METHOD(reflection_function, hasReturnType)
+ZEND_METHOD(ReflectionFunctionAbstract, hasReturnType)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -3342,13 +3303,13 @@ ZEND_METHOD(reflection_function, hasReturnType)
/* {{{ proto public string ReflectionFunctionAbstract::getReturnType()
Returns the return type associated with the function */
-ZEND_METHOD(reflection_function, getReturnType)
+ZEND_METHOD(ReflectionFunctionAbstract, getReturnType)
{
reflection_object *intern;
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -3357,19 +3318,19 @@ ZEND_METHOD(reflection_function, getReturnType)
RETURN_NULL();
}
- reflection_type_factory(fptr->common.arg_info[-1].type, return_value);
+ reflection_type_factory(fptr->common.arg_info[-1].type, return_value, 1);
}
/* }}} */
/* {{{ proto public bool ReflectionMethod::isConstructor()
Returns whether this method is the constructor */
-ZEND_METHOD(reflection_method, isConstructor)
+ZEND_METHOD(ReflectionMethod, isConstructor)
{
reflection_object *intern;
zend_function *mptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
/* we need to check if the ctor is the ctor of the class level we we
@@ -3381,13 +3342,13 @@ ZEND_METHOD(reflection_method, isConstructor)
/* {{{ proto public bool ReflectionMethod::isDestructor()
Returns whether this method is static */
-ZEND_METHOD(reflection_method, isDestructor)
+ZEND_METHOD(ReflectionMethod, isDestructor)
{
reflection_object *intern;
zend_function *mptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_DTOR);
@@ -3396,7 +3357,7 @@ ZEND_METHOD(reflection_method, isDestructor)
/* {{{ proto public int ReflectionMethod::getModifiers()
Returns a bitfield of the access modifiers for this method */
-ZEND_METHOD(reflection_method, getModifiers)
+ZEND_METHOD(ReflectionMethod, getModifiers)
{
reflection_object *intern;
zend_function *mptr;
@@ -3404,7 +3365,7 @@ ZEND_METHOD(reflection_method, getModifiers)
| ZEND_ACC_STATIC | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
@@ -3414,7 +3375,7 @@ ZEND_METHOD(reflection_method, getModifiers)
/* {{{ proto public ReflectionClass ReflectionMethod::getDeclaringClass()
Get the declaring class */
-ZEND_METHOD(reflection_method, getDeclaringClass)
+ZEND_METHOD(ReflectionMethod, getDeclaringClass)
{
reflection_object *intern;
zend_function *mptr;
@@ -3422,7 +3383,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
GET_REFLECTION_OBJECT_PTR(mptr);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_reflection_class_factory(mptr->common.scope, return_value);
@@ -3431,7 +3392,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
/* {{{ proto public ReflectionClass ReflectionMethod::getPrototype()
Get the prototype */
-ZEND_METHOD(reflection_method, getPrototype)
+ZEND_METHOD(ReflectionMethod, getPrototype)
{
reflection_object *intern;
zend_function *mptr;
@@ -3439,13 +3400,13 @@ ZEND_METHOD(reflection_method, getPrototype)
GET_REFLECTION_OBJECT_PTR(mptr);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!mptr->common.prototype) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
reflection_method_factory(mptr->common.prototype->common.scope, mptr->common.prototype, NULL, return_value);
@@ -3454,13 +3415,13 @@ ZEND_METHOD(reflection_method, getPrototype)
/* {{{ proto public void ReflectionMethod::setAccessible(bool visible)
Sets whether non-public methods can be invoked */
-ZEND_METHOD(reflection_method, setAccessible)
+ZEND_METHOD(ReflectionMethod, setAccessible)
{
reflection_object *intern;
zend_bool visible;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &visible) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_REFLECTION_P(ZEND_THIS);
@@ -3471,7 +3432,7 @@ ZEND_METHOD(reflection_method, setAccessible)
/* {{{ proto public void ReflectionClassConstant::__construct(mixed class, string name)
Constructor. Throws an Exception in case the given class constant does not exist */
-ZEND_METHOD(reflection_class_constant, __construct)
+ZEND_METHOD(ReflectionClassConstant, __construct)
{
zval *classname, *object;
zend_string *constname;
@@ -3479,8 +3440,8 @@ ZEND_METHOD(reflection_class_constant, __construct)
zend_class_entry *ce;
zend_class_constant *constant = NULL;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zS", &classname, &constname) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &classname, &constname) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -3492,7 +3453,7 @@ ZEND_METHOD(reflection_class_constant, __construct)
if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
- return;
+ RETURN_THROWS();
}
break;
@@ -3501,13 +3462,13 @@ ZEND_METHOD(reflection_class_constant, __construct)
break;
default:
- _DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname));
+ RETURN_THROWS();
}
if ((constant = zend_hash_find_ptr(&ce->constants_table, constname)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class Constant %s::%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(constname));
- return;
+ RETURN_THROWS();
}
intern->ptr = constant;
@@ -3515,13 +3476,13 @@ ZEND_METHOD(reflection_class_constant, __construct)
intern->ce = constant->ce;
intern->ignore_visibility = 0;
ZVAL_STR_COPY(reflection_prop_name(object), constname);
- ZVAL_STR_COPY(reflection_prop_class(object), ce->name);
+ ZVAL_STR_COPY(reflection_prop_class(object), constant->ce->name);
}
/* }}} */
/* {{{ proto public string ReflectionClassConstant::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_class_constant, __toString)
+ZEND_METHOD(ReflectionClassConstant, __toString)
{
reflection_object *intern;
zend_class_constant *ref;
@@ -3529,7 +3490,7 @@ ZEND_METHOD(reflection_class_constant, __toString)
zval name;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
_default_get_name(ZEND_THIS, &name);
@@ -3541,10 +3502,10 @@ ZEND_METHOD(reflection_class_constant, __toString)
/* {{{ proto public string ReflectionClassConstant::getName()
Returns the constant' name */
-ZEND_METHOD(reflection_class_constant, getName)
+ZEND_METHOD(ReflectionClassConstant, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -3556,7 +3517,7 @@ static void _class_constant_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) /
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
RETURN_BOOL(Z_ACCESS_FLAGS(ref->value) & mask);
@@ -3565,7 +3526,7 @@ static void _class_constant_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) /
/* {{{ proto public bool ReflectionClassConstant::isPublic()
Returns whether this constant is public */
-ZEND_METHOD(reflection_class_constant, isPublic)
+ZEND_METHOD(ReflectionClassConstant, isPublic)
{
_class_constant_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PUBLIC);
}
@@ -3573,7 +3534,7 @@ ZEND_METHOD(reflection_class_constant, isPublic)
/* {{{ proto public bool ReflectionClassConstant::isPrivate()
Returns whether this constant is private */
-ZEND_METHOD(reflection_class_constant, isPrivate)
+ZEND_METHOD(ReflectionClassConstant, isPrivate)
{
_class_constant_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PRIVATE);
}
@@ -3581,7 +3542,7 @@ ZEND_METHOD(reflection_class_constant, isPrivate)
/* {{{ proto public bool ReflectionClassConstant::isProtected()
Returns whether this constant is protected */
-ZEND_METHOD(reflection_class_constant, isProtected)
+ZEND_METHOD(ReflectionClassConstant, isProtected)
{
_class_constant_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PROTECTED);
}
@@ -3589,13 +3550,13 @@ ZEND_METHOD(reflection_class_constant, isProtected)
/* {{{ proto public int ReflectionClassConstant::getModifiers()
Returns a bitfield of the access modifiers for this constant */
-ZEND_METHOD(reflection_class_constant, getModifiers)
+ZEND_METHOD(ReflectionClassConstant, getModifiers)
{
reflection_object *intern;
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
@@ -3605,13 +3566,13 @@ ZEND_METHOD(reflection_class_constant, getModifiers)
/* {{{ proto public mixed ReflectionClassConstant::getValue()
Returns this constant's value */
-ZEND_METHOD(reflection_class_constant, getValue)
+ZEND_METHOD(ReflectionClassConstant, getValue)
{
reflection_object *intern;
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
@@ -3624,13 +3585,13 @@ ZEND_METHOD(reflection_class_constant, getValue)
/* {{{ proto public ReflectionClass ReflectionClassConstant::getDeclaringClass()
Get the declaring class */
-ZEND_METHOD(reflection_class_constant, getDeclaringClass)
+ZEND_METHOD(ReflectionClassConstant, getDeclaringClass)
{
reflection_object *intern;
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
@@ -3640,13 +3601,13 @@ ZEND_METHOD(reflection_class_constant, getDeclaringClass)
/* {{{ proto public string ReflectionClassConstant::getDocComment()
Returns the doc comment for this constant */
-ZEND_METHOD(reflection_class_constant, getDocComment)
+ZEND_METHOD(ReflectionClassConstant, getDocComment)
{
reflection_object *intern;
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->doc_comment) {
@@ -3656,14 +3617,6 @@ ZEND_METHOD(reflection_class_constant, getDocComment)
}
/* }}} */
-/* {{{ proto public static mixed ReflectionClass::export(mixed argument [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_class, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_class_ptr, 1);
-}
-/* }}} */
-
/* {{{ reflection_class_object_ctor */
static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_object)
{
@@ -3693,14 +3646,14 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
}
} else {
if (!try_convert_to_string(argument)) {
- return;
+ RETURN_THROWS();
}
if ((ce = zend_lookup_class(Z_STR_P(argument))) == NULL) {
if (!EG(exception)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", Z_STRVAL_P(argument));
}
- return;
+ RETURN_THROWS();
}
ZVAL_STR_COPY(reflection_prop_name(object), ce->name);
@@ -3712,14 +3665,14 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
/* {{{ proto public void ReflectionClass::__construct(mixed argument) throws ReflectionException
Constructor. Takes a string or an instance as an argument */
-ZEND_METHOD(reflection_class, __construct)
+ZEND_METHOD(ReflectionClass, __construct)
{
reflection_class_object_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
/* {{{ add_class_vars */
-static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value)
+static void add_class_vars(zend_class_entry *ce, zend_bool statics, zval *return_value)
{
zend_property_info *prop_info;
zval *prop, prop_copy;
@@ -3732,14 +3685,14 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
prop_info->ce != ce)) {
continue;
}
- prop = NULL;
- if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
- prop = &ce->default_static_members_table[prop_info->offset];
- ZVAL_DEINDIRECT(prop);
- } else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
- prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
+
+ zend_bool is_static = (prop_info->flags & ZEND_ACC_STATIC) != 0;
+ if (statics != is_static) {
+ continue;
}
- if (!prop || (prop_info->type && Z_ISUNDEF_P(prop))) {
+
+ prop = property_get_default(prop_info);
+ if (Z_ISUNDEF_P(prop)) {
continue;
}
@@ -3762,13 +3715,13 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
/* {{{ proto public array ReflectionClass::getStaticProperties()
Returns an associative array containing all static property values of the class */
-ZEND_METHOD(reflection_class, getStaticProperties)
+ZEND_METHOD(ReflectionClass, getStaticProperties)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -3784,7 +3737,7 @@ ZEND_METHOD(reflection_class, getStaticProperties)
/* {{{ proto public mixed ReflectionClass::getStaticPropertyValue(string name [, mixed default])
Returns the value of a static property */
-ZEND_METHOD(reflection_class, getStaticPropertyValue)
+ZEND_METHOD(ReflectionClass, getStaticPropertyValue)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -3792,7 +3745,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
zval *prop, *def_value = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z", &name, &def_value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -3817,7 +3770,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
/* {{{ proto public void ReflectionClass::setStaticPropertyValue(string $name, mixed $value)
Sets the value of a static property */
-ZEND_METHOD(reflection_class, setStaticPropertyValue)
+ZEND_METHOD(ReflectionClass, setStaticPropertyValue)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -3826,7 +3779,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zval *variable_ptr, *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -3839,7 +3792,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zend_clear_exception();
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- return;
+ RETURN_THROWS();
}
if (Z_ISREF_P(variable_ptr)) {
@@ -3851,7 +3804,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
}
}
- if (prop_info->type && !zend_verify_property_type(prop_info, value, 0)) {
+ if (ZEND_TYPE_IS_SET(prop_info->type) && !zend_verify_property_type(prop_info, value, 0)) {
return;
}
@@ -3863,13 +3816,13 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
/* {{{ proto public array ReflectionClass::getDefaultProperties()
Returns an associative array containing copies of all default property values of the class */
-ZEND_METHOD(reflection_class, getDefaultProperties)
+ZEND_METHOD(ReflectionClass, getDefaultProperties)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -3883,14 +3836,14 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
/* {{{ proto public string ReflectionClass::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_class, __toString)
+ZEND_METHOD(ReflectionClass, __toString)
{
reflection_object *intern;
zend_class_entry *ce;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
_class_string(&str, ce, &intern->obj, "");
@@ -3900,24 +3853,29 @@ ZEND_METHOD(reflection_class, __toString)
/* {{{ proto public string ReflectionClass::getName()
Returns the class' name */
-ZEND_METHOD(reflection_class, getName)
+ZEND_METHOD(ReflectionClass, getName)
{
+ reflection_object *intern;
+ zend_class_entry *ce;
+
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- _default_get_name(ZEND_THIS, return_value);
+
+ GET_REFLECTION_OBJECT_PTR(ce);
+ RETURN_STR_COPY(ce->name);
}
/* }}} */
/* {{{ proto public bool ReflectionClass::isInternal()
Returns whether this class is an internal class */
-ZEND_METHOD(reflection_class, isInternal)
+ZEND_METHOD(ReflectionClass, isInternal)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS);
@@ -3926,13 +3884,13 @@ ZEND_METHOD(reflection_class, isInternal)
/* {{{ proto public bool ReflectionClass::isUserDefined()
Returns whether this class is user-defined */
-ZEND_METHOD(reflection_class, isUserDefined)
+ZEND_METHOD(ReflectionClass, isUserDefined)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_USER_CLASS);
@@ -3941,13 +3899,13 @@ ZEND_METHOD(reflection_class, isUserDefined)
/* {{{ proto public bool ReflectionClass::isAnonymous()
Returns whether this class is anonymous */
-ZEND_METHOD(reflection_class, isAnonymous)
+ZEND_METHOD(ReflectionClass, isAnonymous)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->ce_flags & ZEND_ACC_ANON_CLASS);
@@ -3956,13 +3914,13 @@ ZEND_METHOD(reflection_class, isAnonymous)
/* {{{ proto public string ReflectionClass::getFileName()
Returns the filename of the file this class was declared in */
-ZEND_METHOD(reflection_class, getFileName)
+ZEND_METHOD(ReflectionClass, getFileName)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
@@ -3974,13 +3932,13 @@ ZEND_METHOD(reflection_class, getFileName)
/* {{{ proto public int ReflectionClass::getStartLine()
Returns the line this class' declaration starts at */
-ZEND_METHOD(reflection_class, getStartLine)
+ZEND_METHOD(ReflectionClass, getStartLine)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
@@ -3992,13 +3950,13 @@ ZEND_METHOD(reflection_class, getStartLine)
/* {{{ proto public int ReflectionClass::getEndLine()
Returns the line this class' declaration ends at */
-ZEND_METHOD(reflection_class, getEndLine)
+ZEND_METHOD(ReflectionClass, getEndLine)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
@@ -4010,13 +3968,13 @@ ZEND_METHOD(reflection_class, getEndLine)
/* {{{ proto public string ReflectionClass::getDocComment()
Returns the doc comment for this class */
-ZEND_METHOD(reflection_class, getDocComment)
+ZEND_METHOD(ReflectionClass, getDocComment)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) {
@@ -4028,13 +3986,13 @@ ZEND_METHOD(reflection_class, getDocComment)
/* {{{ proto public ReflectionMethod ReflectionClass::getConstructor()
Returns the class' constructor if there is one, NULL otherwise */
-ZEND_METHOD(reflection_class, getConstructor)
+ZEND_METHOD(ReflectionClass, getConstructor)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4048,14 +4006,14 @@ ZEND_METHOD(reflection_class, getConstructor)
/* {{{ proto public bool ReflectionClass::hasMethod(string name)
Returns whether a method exists or not */
-ZEND_METHOD(reflection_class, hasMethod)
+ZEND_METHOD(ReflectionClass, hasMethod)
{
reflection_object *intern;
zend_class_entry *ce;
zend_string *name, *lc_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4067,7 +4025,7 @@ ZEND_METHOD(reflection_class, hasMethod)
/* {{{ proto public ReflectionMethod ReflectionClass::getMethod(string name) throws ReflectionException
Returns the class' method specified by its name */
-ZEND_METHOD(reflection_class, getMethod)
+ZEND_METHOD(ReflectionClass, getMethod)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4076,7 +4034,7 @@ ZEND_METHOD(reflection_class, getMethod)
zend_string *name, *lc_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4106,6 +4064,10 @@ ZEND_METHOD(reflection_class, getMethod)
/* {{{ _addmethod */
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, zend_long filter)
{
+ if ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) && mptr->common.scope != ce) {
+ return;
+ }
+
if (mptr->common.fn_flags & filter) {
zval method;
reflection_method_factory(ce, mptr, NULL, &method);
@@ -4116,7 +4078,7 @@ static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval,
/* {{{ proto public ReflectionMethod[] ReflectionClass::getMethods([long $filter])
Returns an array of this class' methods */
-ZEND_METHOD(reflection_class, getMethods)
+ZEND_METHOD(ReflectionClass, getMethods)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4125,7 +4087,7 @@ ZEND_METHOD(reflection_class, getMethods)
zend_bool filter_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (filter_is_null) {
@@ -4162,16 +4124,15 @@ ZEND_METHOD(reflection_class, getMethods)
/* {{{ proto public bool ReflectionClass::hasProperty(string name)
Returns whether a property exists or not */
-ZEND_METHOD(reflection_class, hasProperty)
+ZEND_METHOD(ReflectionClass, hasProperty)
{
reflection_object *intern;
zend_property_info *property_info;
zend_class_entry *ce;
zend_string *name;
- zval property;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4182,12 +4143,9 @@ ZEND_METHOD(reflection_class, hasProperty)
RETURN_TRUE;
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF) {
- ZVAL_STR_COPY(&property, name);
- if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL)) {
- zval_ptr_dtor(&property);
+ if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) {
RETURN_TRUE;
}
- zval_ptr_dtor(&property);
}
RETURN_FALSE;
}
@@ -4196,7 +4154,7 @@ ZEND_METHOD(reflection_class, hasProperty)
/* {{{ proto public ReflectionProperty ReflectionClass::getProperty(string name) throws ReflectionException
Returns the class' property specified by its name */
-ZEND_METHOD(reflection_class, getProperty)
+ZEND_METHOD(ReflectionClass, getProperty)
{
reflection_object *intern;
zend_class_entry *ce, *ce2;
@@ -4206,25 +4164,19 @@ ZEND_METHOD(reflection_class, getProperty)
size_t classname_len, str_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
if (!(property_info->flags & ZEND_ACC_PRIVATE) || property_info->ce == ce) {
- reflection_property_factory(ce, name, property_info, return_value, 0);
+ reflection_property_factory(ce, name, property_info, return_value);
return;
}
} else if (Z_TYPE(intern->obj) != IS_UNDEF) {
/* Check for dynamic properties */
- if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj), name)) {
- zend_property_info property_info_tmp;
- property_info_tmp.flags = ZEND_ACC_PUBLIC;
- property_info_tmp.name = name;
- property_info_tmp.doc_comment = NULL;
- property_info_tmp.ce = ce;
-
- reflection_property_factory(ce, name, &property_info_tmp, return_value, 1);
+ if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) {
+ reflection_property_factory(ce, name, NULL, return_value);
return;
}
}
@@ -4243,13 +4195,13 @@ ZEND_METHOD(reflection_class, getProperty)
zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname));
}
zend_string_release_ex(classname, 0);
- return;
+ RETURN_THROWS();
}
zend_string_release_ex(classname, 0);
if (!instanceof_function(ce, ce2)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
ce = ce2;
@@ -4275,7 +4227,7 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_
if (pptr->flags & filter) {
zval property;
- reflection_property_factory(ce, key, pptr, &property, 0);
+ reflection_property_factory(ce, key, pptr, &property);
add_next_index_zval(retval, &property);
}
}
@@ -4284,7 +4236,6 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_
/* {{{ _adddynproperty */
static void _adddynproperty(zval *ptr, zend_string *key, zend_class_entry *ce, zval *retval)
{
- zend_property_info property_info;
zval property;
/* under some circumstances, the properties hash table may contain numeric
@@ -4299,19 +4250,14 @@ static void _adddynproperty(zval *ptr, zend_string *key, zend_class_entry *ce, z
return;
}
- property_info.doc_comment = NULL;
- property_info.flags = ZEND_ACC_PUBLIC;
- property_info.name = key;
- property_info.ce = ce;
- property_info.offset = -1;
- reflection_property_factory(ce, key, &property_info, &property, 1);
+ reflection_property_factory(ce, key, NULL, &property);
add_next_index_zval(retval, &property);
}
/* }}} */
/* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties([long $filter])
Returns an array of this class' properties */
-ZEND_METHOD(reflection_class, getProperties)
+ZEND_METHOD(ReflectionClass, getProperties)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4321,7 +4267,7 @@ ZEND_METHOD(reflection_class, getProperties)
zend_bool filter_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (filter_is_null) {
@@ -4336,7 +4282,7 @@ ZEND_METHOD(reflection_class, getProperties)
} ZEND_HASH_FOREACH_END();
if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) {
- HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj);
+ HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj));
zval *prop;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
_adddynproperty(prop, key, ce, return_value);
@@ -4347,14 +4293,14 @@ ZEND_METHOD(reflection_class, getProperties)
/* {{{ proto public bool ReflectionClass::hasConstant(string name)
Returns whether a constant exists or not */
-ZEND_METHOD(reflection_class, hasConstant)
+ZEND_METHOD(ReflectionClass, hasConstant)
{
reflection_object *intern;
zend_class_entry *ce;
zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4368,7 +4314,7 @@ ZEND_METHOD(reflection_class, hasConstant)
/* {{{ proto public array ReflectionClass::getConstants()
Returns an associative array containing this class' constants and their values */
-ZEND_METHOD(reflection_class, getConstants)
+ZEND_METHOD(ReflectionClass, getConstants)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4377,7 +4323,7 @@ ZEND_METHOD(reflection_class, getConstants)
zval val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -4394,7 +4340,7 @@ ZEND_METHOD(reflection_class, getConstants)
/* {{{ proto public array ReflectionClass::getReflectionConstants()
Returns an associative array containing this class' constants as ReflectionClassConstant objects */
-ZEND_METHOD(reflection_class, getReflectionConstants)
+ZEND_METHOD(ReflectionClass, getReflectionConstants)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4402,13 +4348,13 @@ ZEND_METHOD(reflection_class, getReflectionConstants)
zend_class_constant *constant;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, name, constant) {
zval class_const;
- reflection_class_constant_factory(ce, name, constant, &class_const);
+ reflection_class_constant_factory(name, constant, &class_const);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &class_const);
} ZEND_HASH_FOREACH_END();
}
@@ -4416,7 +4362,7 @@ ZEND_METHOD(reflection_class, getReflectionConstants)
/* {{{ proto public mixed ReflectionClass::getConstant(string name)
Returns the class' constant specified by its name */
-ZEND_METHOD(reflection_class, getConstant)
+ZEND_METHOD(ReflectionClass, getConstant)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4424,7 +4370,7 @@ ZEND_METHOD(reflection_class, getConstant)
zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4442,7 +4388,7 @@ ZEND_METHOD(reflection_class, getConstant)
/* {{{ proto public mixed ReflectionClass::getReflectionConstant(string name)
Returns the class' constant as ReflectionClassConstant objects */
-ZEND_METHOD(reflection_class, getReflectionConstant)
+ZEND_METHOD(ReflectionClass, getReflectionConstant)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4451,13 +4397,13 @@ ZEND_METHOD(reflection_class, getReflectionConstant)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((constant = zend_hash_find_ptr(&ce->constants_table, name)) == NULL) {
RETURN_FALSE;
}
- reflection_class_constant_factory(ce, name, constant, return_value);
+ reflection_class_constant_factory(name, constant, return_value);
}
/* }}} */
@@ -4468,7 +4414,7 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETVAL_BOOL(ce->ce_flags & mask);
@@ -4477,13 +4423,13 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
/* {{{ proto public bool ReflectionClass::isInstantiable()
Returns whether this class is instantiable */
-ZEND_METHOD(reflection_class, isInstantiable)
+ZEND_METHOD(ReflectionClass, isInstantiable)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
@@ -4502,14 +4448,14 @@ ZEND_METHOD(reflection_class, isInstantiable)
/* {{{ proto public bool ReflectionClass::isCloneable()
Returns whether this class is cloneable */
-ZEND_METHOD(reflection_class, isCloneable)
+ZEND_METHOD(ReflectionClass, isCloneable)
{
reflection_object *intern;
zend_class_entry *ce;
zval obj;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
@@ -4539,7 +4485,7 @@ ZEND_METHOD(reflection_class, isCloneable)
/* {{{ proto public bool ReflectionClass::isInterface()
Returns whether this is an interface or a class */
-ZEND_METHOD(reflection_class, isInterface)
+ZEND_METHOD(ReflectionClass, isInterface)
{
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_INTERFACE);
}
@@ -4547,7 +4493,7 @@ ZEND_METHOD(reflection_class, isInterface)
/* {{{ proto public bool ReflectionClass::isTrait()
Returns whether this is a trait */
-ZEND_METHOD(reflection_class, isTrait)
+ZEND_METHOD(ReflectionClass, isTrait)
{
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_TRAIT);
}
@@ -4555,7 +4501,7 @@ ZEND_METHOD(reflection_class, isTrait)
/* {{{ proto public bool ReflectionClass::isFinal()
Returns whether this class is final */
-ZEND_METHOD(reflection_class, isFinal)
+ZEND_METHOD(ReflectionClass, isFinal)
{
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL);
}
@@ -4563,7 +4509,7 @@ ZEND_METHOD(reflection_class, isFinal)
/* {{{ proto public bool ReflectionClass::isAbstract()
Returns whether this class is abstract */
-ZEND_METHOD(reflection_class, isAbstract)
+ZEND_METHOD(ReflectionClass, isAbstract)
{
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
}
@@ -4571,7 +4517,7 @@ ZEND_METHOD(reflection_class, isAbstract)
/* {{{ proto public int ReflectionClass::getModifiers()
Returns a bitfield of the access modifiers for this class */
-ZEND_METHOD(reflection_class, getModifiers)
+ZEND_METHOD(ReflectionClass, getModifiers)
{
reflection_object *intern;
zend_class_entry *ce;
@@ -4579,7 +4525,7 @@ ZEND_METHOD(reflection_class, getModifiers)
| ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4589,23 +4535,23 @@ ZEND_METHOD(reflection_class, getModifiers)
/* {{{ proto public bool ReflectionClass::isInstance(stdclass object)
Returns whether the given object is an instance of this class */
-ZEND_METHOD(reflection_class, isInstance)
+ZEND_METHOD(ReflectionClass, isInstance)
{
reflection_object *intern;
zend_class_entry *ce;
zval *object;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(instanceof_function(Z_OBJCE_P(object), ce));
}
/* }}} */
-/* {{{ proto public object ReflectionClass::newInstance(mixed* args, ...)
+/* {{{ proto public object ReflectionClass::newInstance([mixed* args], ...)
Returns an instance of this class */
-ZEND_METHOD(reflection_class, newInstance)
+ZEND_METHOD(ReflectionClass, newInstance)
{
zval retval;
reflection_object *intern;
@@ -4638,7 +4584,7 @@ ZEND_METHOD(reflection_class, newInstance)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &params, &num_args) == FAILURE) {
zval_ptr_dtor(return_value);
- RETURN_FALSE;
+ RETURN_THROWS();
}
for (i = 0; i < num_args; i++) {
@@ -4679,17 +4625,21 @@ ZEND_METHOD(reflection_class, newInstance)
/* {{{ proto public object ReflectionClass::newInstanceWithoutConstructor()
Returns an instance of this class without invoking its constructor */
-ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
+ZEND_METHOD(ReflectionClass, newInstanceWithoutConstructor)
{
reflection_object *intern;
zend_class_entry *ce;
GET_REFLECTION_OBJECT_PTR(ce);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (ce->type == ZEND_INTERNAL_CLASS
&& ce->create_object != NULL && (ce->ce_flags & ZEND_ACC_FINAL)) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
object_init_ex(return_value, ce);
@@ -4698,7 +4648,7 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
/* {{{ proto public object ReflectionClass::newInstanceArgs([array args])
Returns an instance of this class */
-ZEND_METHOD(reflection_class, newInstanceArgs)
+ZEND_METHOD(ReflectionClass, newInstanceArgs)
{
zval retval, *val;
reflection_object *intern;
@@ -4710,7 +4660,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|h", &args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 0) {
@@ -4785,13 +4735,13 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
/* {{{ proto public ReflectionClass[] ReflectionClass::getInterfaces()
Returns an array of interfaces this class implements */
-ZEND_METHOD(reflection_class, getInterfaces)
+ZEND_METHOD(ReflectionClass, getInterfaces)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4813,14 +4763,14 @@ ZEND_METHOD(reflection_class, getInterfaces)
/* {{{ proto public String[] ReflectionClass::getInterfaceNames()
Returns an array of names of interfaces this class implements */
-ZEND_METHOD(reflection_class, getInterfaceNames)
+ZEND_METHOD(ReflectionClass, getInterfaceNames)
{
reflection_object *intern;
zend_class_entry *ce;
uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4840,14 +4790,14 @@ ZEND_METHOD(reflection_class, getInterfaceNames)
/* {{{ proto public ReflectionClass[] ReflectionClass::getTraits()
Returns an array of traits used by this class */
-ZEND_METHOD(reflection_class, getTraits)
+ZEND_METHOD(ReflectionClass, getTraits)
{
reflection_object *intern;
zend_class_entry *ce;
uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4872,14 +4822,14 @@ ZEND_METHOD(reflection_class, getTraits)
/* {{{ proto public String[] ReflectionClass::getTraitNames()
Returns an array of names of traits used by this class */
-ZEND_METHOD(reflection_class, getTraitNames)
+ZEND_METHOD(ReflectionClass, getTraitNames)
{
reflection_object *intern;
zend_class_entry *ce;
uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4897,13 +4847,13 @@ ZEND_METHOD(reflection_class, getTraitNames)
/* {{{ proto public array ReflectionClass::getTraitAliases()
Returns an array of trait aliases */
-ZEND_METHOD(reflection_class, getTraitAliases)
+ZEND_METHOD(ReflectionClass, getTraitAliases)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4932,13 +4882,13 @@ ZEND_METHOD(reflection_class, getTraitAliases)
/* {{{ proto public ReflectionClass ReflectionClass::getParentClass()
Returns the class' parent class, or, if none exists, FALSE */
-ZEND_METHOD(reflection_class, getParentClass)
+ZEND_METHOD(ReflectionClass, getParentClass)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4952,7 +4902,7 @@ ZEND_METHOD(reflection_class, getParentClass)
/* {{{ proto public bool ReflectionClass::isSubclassOf(string|ReflectionClass class)
Returns whether this class is a subclass of another class */
-ZEND_METHOD(reflection_class, isSubclassOf)
+ZEND_METHOD(ReflectionClass, isSubclassOf)
{
reflection_object *intern, *argument;
zend_class_entry *ce, *class_ce;
@@ -4961,7 +4911,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &class_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (Z_TYPE_P(class_name)) {
@@ -4969,7 +4919,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
if ((class_ce = zend_lookup_class(Z_STR_P(class_name))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(class_name));
- return;
+ RETURN_THROWS();
}
break;
case IS_OBJECT:
@@ -4977,16 +4927,15 @@ ZEND_METHOD(reflection_class, isSubclassOf)
argument = Z_REFLECTION_P(class_name);
if (argument->ptr == NULL) {
zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
- return;
+ RETURN_THROWS();
}
class_ce = argument->ptr;
break;
}
/* no break */
default:
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Parameter one must either be a string or a ReflectionClass object");
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type ReflectionClass|string, %s given", zend_zval_type_name(class_name));
+ RETURN_THROWS();
}
RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce)));
@@ -4995,7 +4944,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
/* {{{ proto public bool ReflectionClass::implementsInterface(string|ReflectionClass interface_name)
Returns whether this class is a subclass of another class */
-ZEND_METHOD(reflection_class, implementsInterface)
+ZEND_METHOD(ReflectionClass, implementsInterface)
{
reflection_object *intern, *argument;
zend_class_entry *ce, *interface_ce;
@@ -5004,7 +4953,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &interface) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (Z_TYPE_P(interface)) {
@@ -5012,7 +4961,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
if ((interface_ce = zend_lookup_class(Z_STR_P(interface))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Interface %s does not exist", Z_STRVAL_P(interface));
- return;
+ RETURN_THROWS();
}
break;
case IS_OBJECT:
@@ -5020,22 +4969,21 @@ ZEND_METHOD(reflection_class, implementsInterface)
argument = Z_REFLECTION_P(interface);
if (argument->ptr == NULL) {
zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
- return;
+ RETURN_THROWS();
}
interface_ce = argument->ptr;
break;
}
/* no break */
default:
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Parameter one must either be a string or a ReflectionClass object");
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type ReflectionClass|string, %s given", zend_zval_type_name(interface));
+ RETURN_THROWS();
}
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"%s is not an interface", ZSTR_VAL(interface_ce->name));
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(instanceof_function(ce, interface_ce));
}
@@ -5043,13 +4991,13 @@ ZEND_METHOD(reflection_class, implementsInterface)
/* {{{ proto public bool ReflectionClass::isIterable()
Returns whether this class is iterable (can be used inside foreach) */
-ZEND_METHOD(reflection_class, isIterable)
+ZEND_METHOD(ReflectionClass, isIterable)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -5065,13 +5013,13 @@ ZEND_METHOD(reflection_class, isIterable)
/* {{{ proto public ReflectionExtension|NULL ReflectionClass::getExtension()
Returns NULL or the extension the class belongs to */
-ZEND_METHOD(reflection_class, getExtension)
+ZEND_METHOD(ReflectionClass, getExtension)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -5084,13 +5032,13 @@ ZEND_METHOD(reflection_class, getExtension)
/* {{{ proto public string|false ReflectionClass::getExtensionName()
Returns false or the name of the extension the class belongs to */
-ZEND_METHOD(reflection_class, getExtensionName)
+ZEND_METHOD(ReflectionClass, getExtensionName)
{
reflection_object *intern;
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -5105,45 +5053,40 @@ ZEND_METHOD(reflection_class, getExtensionName)
/* {{{ proto public bool ReflectionClass::inNamespace()
Returns whether this class is defined in namespace */
-ZEND_METHOD(reflection_class, inNamespace)
+ZEND_METHOD(ReflectionClass, inNamespace)
{
- zval *name;
- const char *backslash;
+ reflection_object *intern;
+ zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if ((name = _default_load_name(ZEND_THIS)) == NULL) {
- RETURN_FALSE;
- }
- if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
- && backslash > Z_STRVAL_P(name))
- {
- RETURN_TRUE;
- }
- RETURN_FALSE;
+
+ GET_REFLECTION_OBJECT_PTR(ce);
+
+ zend_string *name = ce->name;
+ const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
+ RETURN_BOOL(backslash && backslash > ZSTR_VAL(name));
}
/* }}} */
/* {{{ proto public string ReflectionClass::getNamespaceName()
Returns the name of namespace where this class is defined */
-ZEND_METHOD(reflection_class, getNamespaceName)
+ZEND_METHOD(ReflectionClass, getNamespaceName)
{
- zval *name;
- const char *backslash;
+ reflection_object *intern;
+ zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- if ((name = _default_load_name(ZEND_THIS)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
- if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
- && backslash > Z_STRVAL_P(name))
- {
- RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name));
+
+ GET_REFLECTION_OBJECT_PTR(ce);
+
+ zend_string *name = ce->name;
+ const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
+ if (backslash && backslash > ZSTR_VAL(name)) {
+ RETURN_STRINGL(ZSTR_VAL(name), backslash - ZSTR_VAL(name));
}
RETURN_EMPTY_STRING();
}
@@ -5151,62 +5094,37 @@ ZEND_METHOD(reflection_class, getNamespaceName)
/* {{{ proto public string ReflectionClass::getShortName()
Returns the short name of the class (without namespace part) */
-ZEND_METHOD(reflection_class, getShortName)
+ZEND_METHOD(ReflectionClass, getShortName)
{
- zval *name;
- const char *backslash;
+ reflection_object *intern;
+ zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if ((name = _default_load_name(ZEND_THIS)) == NULL) {
- RETURN_FALSE;
- }
- if (Z_TYPE_P(name) == IS_STRING
- && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name)))
- && backslash > Z_STRVAL_P(name))
- {
- RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1));
- }
- ZVAL_COPY_DEREF(return_value, name);
-}
-/* }}} */
-/* {{{ proto public static mixed ReflectionObject::export(mixed argument [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_object, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_object_ptr, 1);
+ GET_REFLECTION_OBJECT_PTR(ce);
+
+ zend_string *name = ce->name;
+ const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
+ if (backslash && backslash > ZSTR_VAL(name)) {
+ RETURN_STRINGL(backslash + 1, ZSTR_LEN(name) - (backslash - ZSTR_VAL(name) + 1));
+ }
+ RETURN_STR_COPY(name);
}
/* }}} */
/* {{{ proto public void ReflectionObject::__construct(mixed argument) throws ReflectionException
Constructor. Takes an instance as an argument */
-ZEND_METHOD(reflection_object, __construct)
+ZEND_METHOD(ReflectionObject, __construct)
{
reflection_class_object_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
-/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_property, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_property_ptr, 2);
-}
-/* }}} */
-
-/* {{{ proto public static mixed ReflectionClassConstant::export(mixed class, string name [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_class_constant, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_class_constant_ptr, 2);
-}
-/* }}} */
-
/* {{{ proto public void ReflectionProperty::__construct(mixed class, string name)
Constructor. Throws an Exception in case the given property does not exist */
-ZEND_METHOD(reflection_property, __construct)
+ZEND_METHOD(ReflectionProperty, __construct)
{
zval *classname;
zend_string *name;
@@ -5217,8 +5135,8 @@ ZEND_METHOD(reflection_property, __construct)
zend_property_info *property_info = NULL;
property_reference *reference;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zS", &classname, &name) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &classname, &name) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -5230,7 +5148,7 @@ ZEND_METHOD(reflection_property, __construct)
if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
- return;
+ RETURN_THROWS();
}
break;
@@ -5239,8 +5157,8 @@ ZEND_METHOD(reflection_property, __construct)
break;
default:
- _DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname));
+ RETURN_THROWS();
}
property_info = zend_hash_find_ptr(&ce->properties_info, name);
@@ -5249,25 +5167,13 @@ ZEND_METHOD(reflection_property, __construct)
&& property_info->ce != ce)) {
/* Check for dynamic properties */
if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) {
- if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) {
+ if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(Z_OBJ_P(classname)), name)) {
dynam_prop = 1;
}
}
if (dynam_prop == 0) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- return;
- }
- }
-
- if (dynam_prop == 0 && (property_info->flags & ZEND_ACC_PRIVATE) == 0) {
- /* we have to search the class hierarchy for this (implicit) public or protected property */
- zend_class_entry *tmp_ce = ce;
- zend_property_info *tmp_info;
-
- while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) {
- ce = tmp_ce;
- property_info = tmp_info;
- tmp_ce = tmp_ce->parent;
+ RETURN_THROWS();
}
}
@@ -5279,16 +5185,7 @@ ZEND_METHOD(reflection_property, __construct)
}
reference = (property_reference*) emalloc(sizeof(property_reference));
- if (dynam_prop) {
- reference->prop.flags = ZEND_ACC_PUBLIC;
- reference->prop.name = name;
- reference->prop.doc_comment = NULL;
- reference->prop.ce = ce;
- reference->dynamic = 1;
- } else {
- reference->prop = *property_info;
- reference->dynamic = 0;
- }
+ reference->prop = dynam_prop ? NULL : property_info;
reference->unmangled_name = zend_string_copy(name);
intern->ptr = reference;
intern->ref_type = REF_TYPE_PROPERTY;
@@ -5299,29 +5196,34 @@ ZEND_METHOD(reflection_property, __construct)
/* {{{ proto public string ReflectionProperty::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_property, __toString)
+ZEND_METHOD(ReflectionProperty, __toString)
{
reflection_object *intern;
property_reference *ref;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- _property_string(&str, &ref->prop, ZSTR_VAL(ref->unmangled_name), "", ref->dynamic);
+ _property_string(&str, ref->prop, ZSTR_VAL(ref->unmangled_name), "");
RETURN_STR(smart_str_extract(&str));
}
/* }}} */
/* {{{ proto public string ReflectionProperty::getName()
Returns the class' name */
-ZEND_METHOD(reflection_property, getName)
+ZEND_METHOD(ReflectionProperty, getName)
{
+ reflection_object *intern;
+ property_reference *ref;
+
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- _default_get_name(ZEND_THIS, return_value);
+
+ GET_REFLECTION_OBJECT_PTR(ref);
+ RETURN_STR_COPY(ref->unmangled_name);
}
/* }}} */
@@ -5331,16 +5233,16 @@ static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) /* {{{
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_BOOL(ref->prop.flags & mask);
+ RETURN_BOOL(prop_get_flags(ref) & mask);
}
/* }}} */
/* {{{ proto public bool ReflectionProperty::isPublic()
Returns whether this property is public */
-ZEND_METHOD(reflection_property, isPublic)
+ZEND_METHOD(ReflectionProperty, isPublic)
{
_property_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PUBLIC);
}
@@ -5348,7 +5250,7 @@ ZEND_METHOD(reflection_property, isPublic)
/* {{{ proto public bool ReflectionProperty::isPrivate()
Returns whether this property is private */
-ZEND_METHOD(reflection_property, isPrivate)
+ZEND_METHOD(ReflectionProperty, isPrivate)
{
_property_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PRIVATE);
}
@@ -5356,7 +5258,7 @@ ZEND_METHOD(reflection_property, isPrivate)
/* {{{ proto public bool ReflectionProperty::isProtected()
Returns whether this property is protected */
-ZEND_METHOD(reflection_property, isProtected)
+ZEND_METHOD(ReflectionProperty, isProtected)
{
_property_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PROTECTED);
}
@@ -5364,7 +5266,7 @@ ZEND_METHOD(reflection_property, isProtected)
/* {{{ proto public bool ReflectionProperty::isStatic()
Returns whether this property is static */
-ZEND_METHOD(reflection_property, isStatic)
+ZEND_METHOD(ReflectionProperty, isStatic)
{
_property_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_STATIC);
}
@@ -5372,55 +5274,59 @@ ZEND_METHOD(reflection_property, isStatic)
/* {{{ proto public bool ReflectionProperty::isDefault()
Returns whether this property is default (declared at compilation time). */
-ZEND_METHOD(reflection_property, isDefault)
+ZEND_METHOD(ReflectionProperty, isDefault)
{
reflection_object *intern;
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_BOOL(!ref->dynamic);
+ RETURN_BOOL(ref->prop != NULL);
}
/* }}} */
/* {{{ proto public int ReflectionProperty::getModifiers()
Returns a bitfield of the access modifiers for this property */
-ZEND_METHOD(reflection_property, getModifiers)
+ZEND_METHOD(ReflectionProperty, getModifiers)
{
reflection_object *intern;
property_reference *ref;
uint32_t keep_flags = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_LONG((ref->prop.flags & keep_flags));
+ RETURN_LONG(prop_get_flags(ref) & keep_flags);
}
/* }}} */
/* {{{ proto public mixed ReflectionProperty::getValue([stdclass object])
Returns this property's value */
-ZEND_METHOD(reflection_property, getValue)
+ZEND_METHOD(ReflectionProperty, getValue)
{
reflection_object *intern;
property_reference *ref;
- zval *object, *name;
+ zval *object = NULL;
zval *member_p = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &object) == FAILURE) {
+ RETURN_THROWS();
+ }
+
GET_REFLECTION_OBJECT_PTR(ref);
- if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
- name = _default_load_name(ZEND_THIS);
+ if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ "Cannot access non-public member %s::$%s",
+ ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->unmangled_name));
+ RETURN_THROWS();
}
- if (ref->prop.flags & ZEND_ACC_STATIC) {
+ if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 0);
if (member_p) {
ZVAL_COPY_DEREF(return_value, member_p);
@@ -5428,13 +5334,15 @@ ZEND_METHOD(reflection_property, getValue)
} else {
zval rv;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) {
- return;
+ if (!object) {
+ zend_type_error("No object provided for getValue() on instance property");
+ RETURN_THROWS();
}
- if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
+ /* TODO: Should this always use intern->ce? */
+ if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- return;
+ RETURN_THROWS();
}
member_p = zend_read_property_ex(intern->ce, object, ref->unmangled_name, 0, &rv);
@@ -5452,34 +5360,34 @@ ZEND_METHOD(reflection_property, getValue)
/* {{{ proto public void ReflectionProperty::setValue([stdclass object,] mixed value)
Sets this property's value */
-ZEND_METHOD(reflection_property, setValue)
+ZEND_METHOD(ReflectionProperty, setValue)
{
reflection_object *intern;
property_reference *ref;
- zval *object, *name;
+ zval *object;
zval *value;
zval *tmp;
GET_REFLECTION_OBJECT_PTR(ref);
- if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
- name = _default_load_name(ZEND_THIS);
+ if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ "Cannot access non-public member %s::$%s",
+ ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->unmangled_name));
+ RETURN_THROWS();
}
- if (ref->prop.flags & ZEND_ACC_STATIC) {
+ if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &tmp, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
zend_update_static_property_ex(intern->ce, ref->unmangled_name, value);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "oz", &object, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_update_property_ex(intern->ce, object, ref->unmangled_name, value);
@@ -5489,46 +5397,50 @@ ZEND_METHOD(reflection_property, setValue)
/* {{{ proto public mixed ReflectionProperty::isInitialized([stdclass object])
Returns this property's value */
-ZEND_METHOD(reflection_property, isInitialized)
+ZEND_METHOD(ReflectionProperty, isInitialized)
{
reflection_object *intern;
property_reference *ref;
- zval *object, *name;
+ zval *object = NULL;
zval *member_p = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &object) == FAILURE) {
+ RETURN_THROWS();
+ }
+
GET_REFLECTION_OBJECT_PTR(ref);
- if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
- name = _default_load_name(getThis());
+ if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ "Cannot access non-public member %s::$%s",
+ ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->unmangled_name));
+ RETURN_THROWS();
}
- if (ref->prop.flags & ZEND_ACC_STATIC) {
+ if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 1);
if (member_p) {
- RETURN_BOOL(!Z_ISUNDEF_P(member_p))
+ RETURN_BOOL(!Z_ISUNDEF_P(member_p));
}
RETURN_FALSE;
} else {
- zval name_zv;
zend_class_entry *old_scope;
int retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) {
- return;
+ if (!object) {
+ zend_type_error("No object provided for isInitialized() on instance property");
+ RETURN_THROWS();
}
- if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
+ /* TODO: Should this always use intern->ce? */
+ if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- return;
+ RETURN_THROWS();
}
old_scope = EG(fake_scope);
EG(fake_scope) = intern->ce;
- ZVAL_STR(&name_zv, ref->unmangled_name);
- retval = Z_OBJ_HT_P(object)->has_property(object, &name_zv, ZEND_PROPERTY_EXISTS, NULL);
+ retval = Z_OBJ_HT_P(object)->has_property(Z_OBJ_P(object), ref->unmangled_name, ZEND_PROPERTY_EXISTS, NULL);
EG(fake_scope) = old_scope;
RETVAL_BOOL(retval);
@@ -5538,49 +5450,35 @@ ZEND_METHOD(reflection_property, isInitialized)
/* {{{ proto public ReflectionClass ReflectionProperty::getDeclaringClass()
Get the declaring class */
-ZEND_METHOD(reflection_property, getDeclaringClass)
+ZEND_METHOD(ReflectionProperty, getDeclaringClass)
{
reflection_object *intern;
property_reference *ref;
- zend_class_entry *tmp_ce, *ce;
- zend_property_info *tmp_info;
+ zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- ce = tmp_ce = intern->ce;
- while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, ref->unmangled_name)) != NULL) {
- if (tmp_info->flags & ZEND_ACC_PRIVATE) {
- /* it's a private property, so it can't be inherited */
- break;
- }
- ce = tmp_ce;
- if (tmp_ce == tmp_info->ce) {
- /* declared in this class, done */
- break;
- }
- tmp_ce = tmp_ce->parent;
- }
-
+ ce = ref->prop ? ref->prop->ce : intern->ce;
zend_reflection_class_factory(ce, return_value);
}
/* }}} */
/* {{{ proto public string ReflectionProperty::getDocComment()
Returns the doc comment for this property */
-ZEND_METHOD(reflection_property, getDocComment)
+ZEND_METHOD(ReflectionProperty, getDocComment)
{
reflection_object *intern;
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- if (ref->prop.doc_comment) {
- RETURN_STR_COPY(ref->prop.doc_comment);
+ if (ref->prop && ref->prop->doc_comment) {
+ RETURN_STR_COPY(ref->prop->doc_comment);
}
RETURN_FALSE;
}
@@ -5588,13 +5486,13 @@ ZEND_METHOD(reflection_property, getDocComment)
/* {{{ proto public int ReflectionProperty::setAccessible(bool visible)
Sets whether non-public properties can be requested */
-ZEND_METHOD(reflection_property, setAccessible)
+ZEND_METHOD(ReflectionProperty, setAccessible)
{
reflection_object *intern;
zend_bool visible;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &visible) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_REFLECTION_P(ZEND_THIS);
@@ -5605,53 +5503,111 @@ ZEND_METHOD(reflection_property, setAccessible)
/* {{{ proto public ReflectionType ReflectionProperty::getType()
Returns the type associated with the property */
-ZEND_METHOD(reflection_property, getType)
+ZEND_METHOD(ReflectionProperty, getType)
{
reflection_object *intern;
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- if (!ZEND_TYPE_IS_SET(ref->prop.type)) {
+ if (!ref->prop || !ZEND_TYPE_IS_SET(ref->prop->type)) {
RETURN_NULL();
}
- reflection_type_factory(ref->prop.type, return_value);
+ reflection_type_factory(ref->prop->type, return_value, 1);
}
/* }}} */
/* {{{ proto public bool ReflectionProperty::hasType()
Returns whether property has a type */
-ZEND_METHOD(reflection_property, hasType)
+ZEND_METHOD(ReflectionProperty, hasType)
{
reflection_object *intern;
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETVAL_BOOL(ZEND_TYPE_IS_SET(ref->prop.type));
+ RETVAL_BOOL(ref->prop && ZEND_TYPE_IS_SET(ref->prop->type));
}
/* }}} */
-/* {{{ proto public static mixed ReflectionExtension::export(string name [, bool return]) throws ReflectionException
- Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_extension, export)
+/* {{{ proto public bool ReflectionProperty::hasDefaultValue()
+ Returns whether property has a default value */
+ZEND_METHOD(ReflectionProperty, hasDefaultValue)
{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_extension_ptr, 1);
+ reflection_object *intern;
+ property_reference *ref;
+ zend_property_info *prop_info;
+ zval *prop;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ GET_REFLECTION_OBJECT_PTR(ref);
+
+ prop_info = ref->prop;
+
+ if (prop_info == NULL) {
+ RETURN_FALSE;
+ }
+
+ prop = property_get_default(prop_info);
+ RETURN_BOOL(!Z_ISUNDEF_P(prop));
+}
+/* }}} */
+
+/* {{{ proto public mixed ReflectionProperty::getDefaultValue()
+ Returns the default value of a property */
+ZEND_METHOD(ReflectionProperty, getDefaultValue)
+{
+ reflection_object *intern;
+ property_reference *ref;
+ zend_property_info *prop_info;
+ zval *prop;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ GET_REFLECTION_OBJECT_PTR(ref);
+
+ prop_info = ref->prop;
+
+ if (prop_info == NULL) {
+ return; // throw exception?
+ }
+
+ prop = property_get_default(prop_info);
+ if (Z_ISUNDEF_P(prop)) {
+ return;
+ }
+
+ /* copy: enforce read only access */
+ ZVAL_DEREF(prop);
+ ZVAL_COPY_OR_DUP(return_value, prop);
+
+ /* this is necessary to make it able to work with default array
+ * properties, returned to user */
+ if (Z_TYPE_P(return_value) == IS_CONSTANT_AST) {
+ if (UNEXPECTED(zval_update_constant_ex(return_value, prop_info->ce) != SUCCESS)) {
+ RETURN_THROWS();
+ }
+ }
}
/* }}} */
/* {{{ proto public void ReflectionExtension::__construct(string name)
Constructor. Throws an Exception in case the given extension does not exist */
-ZEND_METHOD(reflection_extension, __construct)
+ZEND_METHOD(ReflectionExtension, __construct)
{
zval *object;
char *lcname;
@@ -5661,8 +5617,8 @@ ZEND_METHOD(reflection_extension, __construct)
size_t name_len;
ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -5673,7 +5629,7 @@ ZEND_METHOD(reflection_extension, __construct)
free_alloca(lcname, use_heap);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Extension %s does not exist", name_str);
- return;
+ RETURN_THROWS();
}
free_alloca(lcname, use_heap);
ZVAL_STRING(reflection_prop_name(object), module->name);
@@ -5685,14 +5641,14 @@ ZEND_METHOD(reflection_extension, __construct)
/* {{{ proto public string ReflectionExtension::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_extension, __toString)
+ZEND_METHOD(ReflectionExtension, __toString)
{
reflection_object *intern;
zend_module_entry *module;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
_extension_string(&str, module, "");
@@ -5702,24 +5658,29 @@ ZEND_METHOD(reflection_extension, __toString)
/* {{{ proto public string ReflectionExtension::getName()
Returns this extension's name */
-ZEND_METHOD(reflection_extension, getName)
+ZEND_METHOD(ReflectionExtension, getName)
{
+ reflection_object *intern;
+ zend_module_entry *module;
+
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- _default_get_name(ZEND_THIS, return_value);
+
+ GET_REFLECTION_OBJECT_PTR(module);
+ RETURN_STRING(module->name);
}
/* }}} */
/* {{{ proto public string ReflectionExtension::getVersion()
Returns this extension's version */
-ZEND_METHOD(reflection_extension, getVersion)
+ZEND_METHOD(ReflectionExtension, getVersion)
{
reflection_object *intern;
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5734,7 +5695,7 @@ ZEND_METHOD(reflection_extension, getVersion)
/* {{{ proto public ReflectionFunction[] ReflectionExtension::getFunctions()
Returns an array of this extension's functions */
-ZEND_METHOD(reflection_extension, getFunctions)
+ZEND_METHOD(ReflectionExtension, getFunctions)
{
reflection_object *intern;
zend_module_entry *module;
@@ -5742,7 +5703,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5759,14 +5720,14 @@ ZEND_METHOD(reflection_extension, getFunctions)
/* {{{ proto public array ReflectionExtension::getConstants()
Returns an associative array containing this extension's constants and their values */
-ZEND_METHOD(reflection_extension, getConstants)
+ZEND_METHOD(ReflectionExtension, getConstants)
{
reflection_object *intern;
zend_module_entry *module;
zend_constant *constant;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5798,14 +5759,14 @@ static void _addinientry(zend_ini_entry *ini_entry, zval *retval, int number)
/* {{{ proto public array ReflectionExtension::getINIEntries()
Returns an associative array containing this extension's INI entries and their values */
-ZEND_METHOD(reflection_extension, getINIEntries)
+ZEND_METHOD(ReflectionExtension, getINIEntries)
{
reflection_object *intern;
zend_module_entry *module;
zend_ini_entry *ini_entry;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5842,7 +5803,7 @@ static void add_extension_class(zend_class_entry *ce, zend_string *key, zval *cl
/* {{{ proto public ReflectionClass[] ReflectionExtension::getClasses()
Returns an array containing ReflectionClass objects for all classes of this extension */
-ZEND_METHOD(reflection_extension, getClasses)
+ZEND_METHOD(ReflectionExtension, getClasses)
{
reflection_object *intern;
zend_module_entry *module;
@@ -5850,7 +5811,7 @@ ZEND_METHOD(reflection_extension, getClasses)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5863,7 +5824,7 @@ ZEND_METHOD(reflection_extension, getClasses)
/* {{{ proto public array ReflectionExtension::getClassNames()
Returns an array containing all names of all classes of this extension */
-ZEND_METHOD(reflection_extension, getClassNames)
+ZEND_METHOD(ReflectionExtension, getClassNames)
{
reflection_object *intern;
zend_module_entry *module;
@@ -5871,7 +5832,7 @@ ZEND_METHOD(reflection_extension, getClassNames)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5884,14 +5845,14 @@ ZEND_METHOD(reflection_extension, getClassNames)
/* {{{ proto public array ReflectionExtension::getDependencies()
Returns an array containing all names of all extensions this extension depends on */
-ZEND_METHOD(reflection_extension, getDependencies)
+ZEND_METHOD(ReflectionExtension, getDependencies)
{
reflection_object *intern;
zend_module_entry *module;
const zend_module_dep *dep;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5950,13 +5911,13 @@ ZEND_METHOD(reflection_extension, getDependencies)
/* {{{ proto public void ReflectionExtension::info()
Prints phpinfo block for the extension */
-ZEND_METHOD(reflection_extension, info)
+ZEND_METHOD(ReflectionExtension, info)
{
reflection_object *intern;
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5966,13 +5927,13 @@ ZEND_METHOD(reflection_extension, info)
/* {{{ proto public bool ReflectionExtension::isPersistent()
Returns whether this extension is persistent */
-ZEND_METHOD(reflection_extension, isPersistent)
+ZEND_METHOD(ReflectionExtension, isPersistent)
{
reflection_object *intern;
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5982,13 +5943,13 @@ ZEND_METHOD(reflection_extension, isPersistent)
/* {{{ proto public bool ReflectionExtension::isTemporary()
Returns whether this extension is temporary */
-ZEND_METHOD(reflection_extension, isTemporary)
+ZEND_METHOD(ReflectionExtension, isTemporary)
{
reflection_object *intern;
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5996,17 +5957,9 @@ ZEND_METHOD(reflection_extension, isTemporary)
}
/* }}} */
-/* {{{ proto public static mixed ReflectionZendExtension::export(string name [, bool return]) throws ReflectionException
- * Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
-ZEND_METHOD(reflection_zend_extension, export)
-{
- _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_zend_extension_ptr, 1);
-}
-/* }}} */
-
/* {{{ proto public void ReflectionZendExtension::__construct(string name)
Constructor. Throws an Exception in case the given Zend extension does not exist */
-ZEND_METHOD(reflection_zend_extension, __construct)
+ZEND_METHOD(ReflectionZendExtension, __construct)
{
zval *object;
reflection_object *intern;
@@ -6014,8 +5967,8 @@ ZEND_METHOD(reflection_zend_extension, __construct)
char *name_str;
size_t name_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -6025,7 +5978,7 @@ ZEND_METHOD(reflection_zend_extension, __construct)
if (!extension) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Zend Extension %s does not exist", name_str);
- return;
+ RETURN_THROWS();
}
ZVAL_STRING(reflection_prop_name(object), extension->name);
intern->ptr = extension;
@@ -6036,14 +5989,14 @@ ZEND_METHOD(reflection_zend_extension, __construct)
/* {{{ proto public string ReflectionZendExtension::__toString()
Returns a string representation */
-ZEND_METHOD(reflection_zend_extension, __toString)
+ZEND_METHOD(ReflectionZendExtension, __toString)
{
reflection_object *intern;
zend_extension *extension;
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
_zend_extension_string(&str, extension, "");
@@ -6053,13 +6006,13 @@ ZEND_METHOD(reflection_zend_extension, __toString)
/* {{{ proto public string ReflectionZendExtension::getName()
Returns the name of this Zend extension */
-ZEND_METHOD(reflection_zend_extension, getName)
+ZEND_METHOD(ReflectionZendExtension, getName)
{
reflection_object *intern;
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6069,13 +6022,13 @@ ZEND_METHOD(reflection_zend_extension, getName)
/* {{{ proto public string ReflectionZendExtension::getVersion()
Returns the version information of this Zend extension */
-ZEND_METHOD(reflection_zend_extension, getVersion)
+ZEND_METHOD(ReflectionZendExtension, getVersion)
{
reflection_object *intern;
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6089,13 +6042,13 @@ ZEND_METHOD(reflection_zend_extension, getVersion)
/* {{{ proto public void ReflectionZendExtension::getAuthor()
* Returns the name of this Zend extension's author */
-ZEND_METHOD(reflection_zend_extension, getAuthor)
+ZEND_METHOD(ReflectionZendExtension, getAuthor)
{
reflection_object *intern;
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6109,13 +6062,13 @@ ZEND_METHOD(reflection_zend_extension, getAuthor)
/* {{{ proto public void ReflectionZendExtension::getURL()
Returns this Zend extension's URL*/
-ZEND_METHOD(reflection_zend_extension, getURL)
+ZEND_METHOD(ReflectionZendExtension, getURL)
{
reflection_object *intern;
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6129,13 +6082,13 @@ ZEND_METHOD(reflection_zend_extension, getURL)
/* {{{ proto public void ReflectionZendExtension::getCopyright()
Returns this Zend extension's copyright information */
-ZEND_METHOD(reflection_zend_extension, getCopyright)
+ZEND_METHOD(ReflectionZendExtension, getCopyright)
{
reflection_object *intern;
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6149,7 +6102,7 @@ ZEND_METHOD(reflection_zend_extension, getCopyright)
/* {{{ proto public ReflectionReference::__construct()
* Dummy constructor -- always throws ReflectionExceptions. */
-ZEND_METHOD(reflection_reference, __construct)
+ZEND_METHOD(ReflectionReference, __construct)
{
_DO_THROW(
"Cannot directly instantiate ReflectionReference. "
@@ -6170,14 +6123,14 @@ static zend_bool is_ignorable_reference(HashTable *ht, zval *ref) {
/* {{{ proto public ReflectionReference|null ReflectionReference::fromArrayElement(array array, mixed key)
* Create ReflectionReference for array item. Returns null if not a reference. */
-ZEND_METHOD(reflection_reference, fromArrayElement)
+ZEND_METHOD(ReflectionReference, fromArrayElement)
{
HashTable *ht;
zval *key, *item;
reflection_object *intern;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "hz", &ht, &key) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "hz", &ht, &key) == FAILURE) {
+ RETURN_THROWS();
}
if (Z_TYPE_P(key) == IS_LONG) {
@@ -6185,13 +6138,13 @@ ZEND_METHOD(reflection_reference, fromArrayElement)
} else if (Z_TYPE_P(key) == IS_STRING) {
item = zend_symtable_find(ht, Z_STR_P(key));
} else {
- zend_type_error("Key must be array or string");
- return;
+ zend_argument_type_error(2, "must be of type string|int, %s given", zend_zval_type_name(key));
+ RETURN_THROWS();
}
if (!item) {
_DO_THROW("Array key not found");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(item) != IS_REFERENCE || is_ignorable_reference(ht, item)) {
@@ -6208,25 +6161,25 @@ ZEND_METHOD(reflection_reference, fromArrayElement)
/* {{{ proto public int|string ReflectionReference::getId()
* Returns a unique identifier for the reference.
* The format of the return value is unspecified and may change. */
-ZEND_METHOD(reflection_reference, getId)
+ZEND_METHOD(ReflectionReference, getId)
{
reflection_object *intern;
unsigned char digest[20];
PHP_SHA1_CTX context;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_REFLECTION_P(getThis());
if (Z_TYPE(intern->obj) != IS_REFERENCE) {
_DO_THROW("Corrupted ReflectionReference object");
- return;
+ RETURN_THROWS();
}
if (!REFLECTION_G(key_initialized)) {
if (php_random_bytes_throw(&REFLECTION_G(key_initialized), 16) == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_G(key_initialized) = 1;
@@ -6242,521 +6195,24 @@ ZEND_METHOD(reflection_reference, getId)
}
/* }}} */
-/* {{{ method tables */
-static const zend_function_entry reflection_exception_functions[] = {
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection__void, 0)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_getModifierNames, 0)
- ZEND_ARG_INFO(0, modifiers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_export, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, reflector, Reflector, 0)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_functions[] = {
- ZEND_ME(reflection, getModifierNames, arginfo_reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_DEP_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_FE_END
-};
-
-static const zend_function_entry reflector_functions[] = {
- ZEND_ABSTRACT_ME(reflector, __toString, arginfo_reflection__void)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_export, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0)
- ZEND_ARG_ARRAY_INFO(0, args, 0)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_function_abstract_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(reflection_function, inNamespace, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isClosure, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isGenerator, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isVariadic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getEndLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getExtension, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getExtensionName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getFileName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getNamespaceName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getNumberOfParameters, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getNumberOfRequiredParameters, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getParameters, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getShortName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getStartLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getStaticVariables, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, returnsReference, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, hasReturnType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getReturnType, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-static const zend_function_entry reflection_function_functions[] = {
- ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0)
- ZEND_ME(reflection_function, __toString, arginfo_reflection__void, 0)
- ZEND_DEP_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_function, isDisabled, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0)
- ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0)
- ZEND_ME(reflection_function, getClosure, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_generator___construct, 0)
- ZEND_ARG_INFO(0, generator)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_generator_trace, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_generator_functions[] = {
- ZEND_ME(reflection_generator, __construct, arginfo_reflection_generator___construct, 0)
- ZEND_ME(reflection_generator, getExecutingLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getExecutingFile, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getTrace, arginfo_reflection_generator_trace, 0)
- ZEND_ME(reflection_generator, getFunction, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getThis, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getExecutingGenerator, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, class_or_method)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invoke, 0)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invokeArgs, 0)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_ARRAY_INFO(0, args, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_setAccessible, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_getClosure, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_method_functions[] = {
- ZEND_DEP_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_method, __construct, arginfo_reflection_method___construct, 0)
- ZEND_ME(reflection_method, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isPublic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isPrivate, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isProtected, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isAbstract, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isFinal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isStatic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isConstructor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isDestructor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, getClosure, arginfo_reflection_method_getClosure, 0)
- ZEND_ME(reflection_method, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, invoke, arginfo_reflection_method_invoke, 0)
- ZEND_ME(reflection_method, invokeArgs, arginfo_reflection_method_invokeArgs, 0)
- ZEND_ME(reflection_method, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, getPrototype, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, setAccessible, arginfo_reflection_method_setAccessible, 0)
- PHP_FE_END
-};
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_export, 0, 0, 1)
- ZEND_ARG_INFO(0, argument)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class___construct, 0)
- ZEND_ARG_INFO(0, argument)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getStaticPropertyValue, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, default)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_setStaticPropertyValue, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasMethod, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getMethod, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getMethods, 0, 0, 0)
- ZEND_ARG_INFO(0, filter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasProperty, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getProperty, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getProperties, 0, 0, 0)
- ZEND_ARG_INFO(0, filter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasConstant, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getConstant, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstanceArgs, 0, 0, 0)
- ZEND_ARG_ARRAY_INFO(0, args, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isSubclassOf, 0)
- ZEND_ARG_INFO(0, class)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_implementsInterface, 0)
- ZEND_ARG_INFO(0, interface)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_class_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_class, __construct, arginfo_reflection_class___construct, 0)
- ZEND_ME(reflection_class, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInternal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isUserDefined, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isAnonymous, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInstantiable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isCloneable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getFileName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getStartLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getEndLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getDocComment, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getConstructor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, hasMethod, arginfo_reflection_class_hasMethod, 0)
- ZEND_ME(reflection_class, getMethod, arginfo_reflection_class_getMethod, 0)
- ZEND_ME(reflection_class, getMethods, arginfo_reflection_class_getMethods, 0)
- ZEND_ME(reflection_class, hasProperty, arginfo_reflection_class_hasProperty, 0)
- ZEND_ME(reflection_class, getProperty, arginfo_reflection_class_getProperty, 0)
- ZEND_ME(reflection_class, getProperties, arginfo_reflection_class_getProperties, 0)
- ZEND_ME(reflection_class, hasConstant, arginfo_reflection_class_hasConstant, 0)
- ZEND_ME(reflection_class, getConstants, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getReflectionConstants, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getConstant, arginfo_reflection_class_getConstant, 0)
- ZEND_ME(reflection_class, getReflectionConstant, arginfo_reflection_class_getConstant, 0)
- ZEND_ME(reflection_class, getInterfaces, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getInterfaceNames, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInterface, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getTraits, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getTraitNames, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getTraitAliases, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isTrait, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isAbstract, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isFinal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInstance, arginfo_reflection_class_isInstance, 0)
- ZEND_ME(reflection_class, newInstance, arginfo_reflection_class_newInstance, 0)
- ZEND_ME(reflection_class, newInstanceWithoutConstructor, arginfo_reflection_class_newInstanceWithoutConstructor, 0)
- ZEND_ME(reflection_class, newInstanceArgs, arginfo_reflection_class_newInstanceArgs, 0)
- ZEND_ME(reflection_class, getParentClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isSubclassOf, arginfo_reflection_class_isSubclassOf, 0)
- ZEND_ME(reflection_class, getStaticProperties, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getStaticPropertyValue, arginfo_reflection_class_getStaticPropertyValue, 0)
- ZEND_ME(reflection_class, setStaticPropertyValue, arginfo_reflection_class_setStaticPropertyValue, 0)
- ZEND_ME(reflection_class, getDefaultProperties, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isIterable, arginfo_reflection__void, 0)
- ZEND_MALIAS(reflection_class, isIterateable, isIterable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, implementsInterface, arginfo_reflection_class_implementsInterface, 0)
- ZEND_ME(reflection_class, getExtension, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getExtensionName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, inNamespace, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getNamespaceName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getShortName, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_object_export, 0, 0, 1)
- ZEND_ARG_INFO(0, argument)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_object___construct, 0)
- ZEND_ARG_INFO(0, argument)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_object_functions[] = {
- ZEND_DEP_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_object, __construct, arginfo_reflection_object___construct, 0)
- PHP_FE_END
-};
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property___construct, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_getValue, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_setValue, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_isInitialized, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccessible, 0)
- ZEND_ARG_INFO(0, visible)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_property_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_property, __construct, arginfo_reflection_property___construct, 0)
- ZEND_ME(reflection_property, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getValue, arginfo_reflection_property_getValue, 0)
- ZEND_ME(reflection_property, setValue, arginfo_reflection_property_setValue, 0)
- ZEND_ME(reflection_property, isInitialized, arginfo_reflection_property_isInitialized, 0)
- ZEND_ME(reflection_property, isPublic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isPrivate, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isProtected, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isStatic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isDefault, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getDocComment, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, setAccessible, arginfo_reflection_property_setAccessible, 0)
- ZEND_ME(reflection_property, getType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, hasType, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant___construct, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_class_constant_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_class_constant, __construct, arginfo_reflection_class_constant___construct, 0)
- ZEND_ME(reflection_class_constant, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getValue, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, isPublic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, isPrivate, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, isProtected, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getDocComment, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_parameter_export, 0, 0, 2)
- ZEND_ARG_INFO(0, function)
- ZEND_ARG_INFO(0, parameter)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_parameter___construct, 0)
- ZEND_ARG_INFO(0, function)
- ZEND_ARG_INFO(0, parameter)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_parameter_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_parameter, __construct, arginfo_reflection_parameter___construct, 0)
- ZEND_ME(reflection_parameter, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isPassedByReference, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, canBePassedByValue, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDeclaringFunction, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, hasType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isArray, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isCallable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, allowsNull, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getPosition, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isOptional, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDefaultValue, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isVariadic, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-static const zend_function_entry reflection_type_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0)
- ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0)
- ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED)
- PHP_FE_END
-};
-
-static const zend_function_entry reflection_named_type_functions[] = {
- ZEND_ME(reflection_named_type, getName, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_extension_export, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_extension___construct, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_extension_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_extension, __construct, arginfo_reflection_extension___construct, 0)
- ZEND_ME(reflection_extension, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getVersion, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getFunctions, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getConstants, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getINIEntries, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getClasses, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getClassNames, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getDependencies, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, info, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, isPersistent, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, isTemporary, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_zend_extension___construct, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_zend_extension_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0)
- ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getVersion, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getAuthor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getURL, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getCopyright, arginfo_reflection__void, 0)
- PHP_FE_END
-};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_reference_fromArrayElement, 0, 0, 2)
- ZEND_ARG_INFO(0, array)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry reflection_reference_functions[] = {
- ZEND_ME(reflection_reference, fromArrayElement, arginfo_reflection_reference_fromArrayElement, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(reflection_reference, getId, arginfo_reflection__void, ZEND_ACC_PUBLIC)
-
- /* Always throwing dummy methods */
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE)
- ZEND_ME(reflection_reference, __construct, arginfo_reflection__void, ZEND_ACC_PRIVATE)
- PHP_FE_END
-};
-/* }}} */
-
static const zend_function_entry reflection_ext_functions[] = { /* {{{ */
PHP_FE_END
}; /* }}} */
/* {{{ _reflection_write_property */
-static zval *_reflection_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- if ((Z_TYPE_P(member) == IS_STRING)
- && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
- && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
- || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
+ if (zend_hash_exists(&object->ce->properties_info, name)
+ && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name")))
+ || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member));
+ "Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));
return &EG(uninitialized_zval);
}
else
{
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
/* }}} */
@@ -6778,47 +6234,54 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
reflection_object_handlers.write_property = _reflection_write_property;
reflection_object_handlers.get_gc = reflection_get_gc;
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", class_ReflectionException_methods);
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_ce_exception);
- INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "Reflection", class_Reflection_methods);
reflection_ptr = zend_register_internal_class(&_reflection_entry);
- INIT_CLASS_ENTRY(_reflection_entry, "Reflector", reflector_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "Reflector", class_Reflector_methods);
reflector_ptr = zend_register_internal_interface(&_reflection_entry);
+ zend_class_implements(reflector_ptr, 1, zend_ce_stringable);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunctionAbstract", reflection_function_abstract_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunctionAbstract", class_ReflectionFunctionAbstract_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_function_abstract_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_function_abstract_ptr, 1, reflector_ptr);
zend_declare_property_string(reflection_function_abstract_ptr, "name", sizeof("name")-1, "", ZEND_ACC_ABSTRACT);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunction", reflection_function_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunction", class_ReflectionFunction_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr);
zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionGenerator", reflection_generator_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionGenerator", class_ReflectionGenerator_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_generator_ptr = zend_register_internal_class(&_reflection_entry);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", class_ReflectionParameter_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_parameter_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_parameter_ptr, 1, reflector_ptr);
zend_declare_property_string(reflection_parameter_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionType", reflection_type_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionType", class_ReflectionType_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_type_ptr = zend_register_internal_class(&_reflection_entry);
+ reflection_type_ptr->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
+ zend_class_implements(reflection_type_ptr, 1, zend_ce_stringable);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionNamedType", reflection_named_type_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionNamedType", class_ReflectionNamedType_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_named_type_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_type_ptr);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionUnionType", class_ReflectionUnionType_methods);
+ reflection_init_class_handlers(&_reflection_entry);
+ reflection_union_type_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_type_ptr);
+
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", class_ReflectionMethod_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr);
zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
@@ -6831,7 +6294,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT);
REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", class_ReflectionClass_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_class_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_class_ptr, 1, reflector_ptr);
@@ -6842,18 +6305,18 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", class_ReflectionObject_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_object_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_class_ptr);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionProperty", reflection_property_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionProperty", class_ReflectionProperty_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_property_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_property_ptr, 1, reflector_ptr);
zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClassConstant", reflection_class_constant_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClassConstant", class_ReflectionClassConstant_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_class_constant_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_class_constant_ptr, 1, reflector_ptr);
@@ -6865,19 +6328,19 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", class_ReflectionExtension_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_extension_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_extension_ptr, 1, reflector_ptr);
zend_declare_property_string(reflection_extension_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionZendExtension", reflection_zend_extension_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionZendExtension", class_ReflectionZendExtension_methods);
reflection_init_class_handlers(&_reflection_entry);
reflection_zend_extension_ptr = zend_register_internal_class(&_reflection_entry);
zend_class_implements(reflection_zend_extension_ptr, 1, reflector_ptr);
zend_declare_property_string(reflection_zend_extension_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
- INIT_CLASS_ENTRY(_reflection_entry, "ReflectionReference", reflection_reference_functions);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionReference", class_ReflectionReference_methods);
reflection_init_class_handlers(&_reflection_entry);
_reflection_entry.ce_flags |= ZEND_ACC_FINAL;
reflection_reference_ptr = zend_register_internal_class(&_reflection_entry);
diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h
index b1d5717e3f..e4e08c16e6 100644
--- a/ext/reflection/php_reflection.h
+++ b/ext/reflection/php_reflection.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php
new file mode 100644
index 0000000000..be6269fe78
--- /dev/null
+++ b/ext/reflection/php_reflection.stub.php
@@ -0,0 +1,638 @@
+<?php
+
+/** @generate-function-entries */
+
+class ReflectionException extends Exception
+{
+}
+
+class Reflection
+{
+ /** @return string[] */
+ public static function getModifierNames(int $modifiers) {}
+}
+
+interface Reflector extends Stringable
+{
+}
+
+abstract class ReflectionFunctionAbstract implements Reflector
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ /** @return bool */
+ public function inNamespace() {}
+
+ /** @return bool */
+ public function isClosure() {}
+
+ /** @return bool */
+ public function isDeprecated() {}
+
+ /** @return bool */
+ public function isInternal() {}
+
+ /** @return bool */
+ public function isUserDefined() {}
+
+ /** @return bool */
+ public function isGenerator() {}
+
+ /** @return bool */
+ public function isVariadic() {}
+
+ /** @return object|null */
+ public function getClosureThis() {}
+
+ /** @return ReflectionClass|null */
+ public function getClosureScopeClass() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+
+ /** @return int|false */
+ public function getEndLine() {}
+
+ /** @return ReflectionExtension|null */
+ public function getExtension() {}
+
+ /** @return string|false */
+ public function getExtensionName() {}
+
+ /** @return string|false */
+ public function getFileName() {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return string */
+ public function getNamespaceName() {}
+
+ /** @return int */
+ public function getNumberOfParameters() {}
+
+ /** @return int */
+ public function getNumberOfRequiredParameters() {}
+
+ /** @return ReflectionParameter[] */
+ public function getParameters() {}
+
+ /** @return string */
+ public function getShortName() {}
+
+ /** @return int|false */
+ public function getStartLine() {}
+
+ /** @return array */
+ public function getStaticVariables() {}
+
+ /** @return bool */
+ public function returnsReference() {}
+
+ /** @return bool */
+ public function hasReturnType() {}
+
+ /** @return ReflectionType|null */
+ public function getReturnType() {}
+}
+
+class ReflectionFunction extends ReflectionFunctionAbstract
+{
+ /** @param string|Closure $name */
+ public function __construct($name) {}
+
+ public function __toString(): string {}
+
+ /** @return bool */
+ public function isDisabled() {}
+
+ /** @return mixed */
+ public function invoke(...$args) {}
+
+ /** @return mixed */
+ public function invokeArgs(array $args) {}
+
+ /** @return Closure */
+ public function getClosure() {}
+}
+
+class ReflectionGenerator
+{
+ public function __construct(Generator $generator) {}
+
+ /** @return int */
+ public function getExecutingLine() {}
+
+ /** @return string */
+ public function getExecutingFile() {}
+
+ /** @return array */
+ public function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT) {}
+
+ /** @return ReflectionFunctionAbstract */
+ public function getFunction() {}
+
+ /** @return object|null */
+ public function getThis() {}
+
+ /** @return Generator */
+ public function getExecutingGenerator() {}
+}
+
+class ReflectionMethod extends ReflectionFunctionAbstract
+{
+ /** @param object|string $class_or_method */
+ public function __construct($class_or_method, string $name = UNKNOWN) {}
+
+ public function __toString(): string {}
+
+ /** @return bool */
+ public function isPublic() {}
+
+ /** @return bool */
+ public function isPrivate() {}
+
+ /** @return bool */
+ public function isProtected() {}
+
+ /** @return bool */
+ public function isAbstract() {}
+
+ /** @return bool */
+ public function isFinal() {}
+
+ /** @return bool */
+ public function isStatic() {}
+
+ /** @return bool */
+ public function isConstructor() {}
+
+ /** @return bool */
+ public function isDestructor() {}
+
+ /** @return Closure */
+ public function getClosure($object = UNKNOWN) {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return mixed */
+ public function invoke(?object $object = null, ...$args) {}
+
+ /** @return mixed */
+ public function invokeArgs(?object $object, array $args) {}
+
+ /** @return ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return ReflectionMethod */
+ public function getPrototype() {}
+
+ /** @return void */
+ public function setAccessible(bool $visible) {}
+}
+
+class ReflectionClass implements Reflector
+{
+ final private function __clone() {}
+
+ /** @param object|string $argument */
+ public function __construct($argument) {}
+
+ public function __toString(): string {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return bool */
+ public function isInternal() {}
+
+ /** @return bool */
+ public function isUserDefined() {}
+
+ /** @return bool */
+ public function isAnonymous() {}
+
+ /** @return bool */
+ public function isInstantiable() {}
+
+ /** @return bool */
+ public function isCloneable() {}
+
+ /** @return string|false */
+ public function getFileName() {}
+
+ /** @return int|false */
+ public function getStartLine() {}
+
+ /** @return int|false */
+ public function getEndLine() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+
+ /** @return ReflectionMethod|null */
+ public function getConstructor() {}
+
+ /** @return bool */
+ public function hasMethod(string $name) {}
+
+ /** @return ReflectionMethod */
+ public function getMethod(string $name) {}
+
+ /** @return ReflectionMethod[] */
+ public function getMethods(?int $filter = null) {}
+
+ /** @return bool */
+ public function hasProperty(string $name) {}
+
+ /** @return ReflectionProperty */
+ public function getProperty(string $name) {}
+
+ /** @return ReflectionProperty[] */
+ public function getProperties(?int $filter = null) {}
+
+ /** @return bool */
+ public function hasConstant(string $name) {}
+
+ /** @return array|null */
+ public function getConstants() {}
+
+ /** @return ReflectionClassConstant[] */
+ public function getReflectionConstants() {}
+
+ /** @return mixed */
+ public function getConstant(string $name) {}
+
+ /** @return ReflectionClassConstant|false */
+ public function getReflectionConstant(string $name) {}
+
+ /** @return ReflectionClass[] */
+ public function getInterfaces() {}
+
+ /** @return string[] */
+ public function getInterfaceNames() {}
+
+ /** @return bool */
+ public function isInterface() {}
+
+ /** @return ReflectionClass[] */
+ public function getTraits() {}
+
+ /** @return string[] */
+ public function getTraitNames() {}
+
+ /** @return string[] */
+ public function getTraitAliases() {}
+
+ /** @return bool */
+ public function isTrait() {}
+
+ /** @return bool */
+ public function isAbstract() {}
+
+ /** @return bool */
+ public function isFinal() {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return bool */
+ public function isInstance(object $object) {}
+
+ /** @return object */
+ public function newInstance(...$args) {}
+
+ /** @return object */
+ public function newInstanceWithoutConstructor() {}
+
+ /** @return object */
+ public function newInstanceArgs(array $args = []) {}
+
+ /** @return ReflectionClass|false */
+ public function getParentClass() {}
+
+ /**
+ * @param string|ReflectionClass $class
+ * @return bool
+ */
+ public function isSubclassOf($class) {}
+
+ /** @return array|null */
+ public function getStaticProperties() {}
+
+ /** @return mixed */
+ public function getStaticPropertyValue(string $name, $default = UNKNOWN) {}
+
+ /** @return void */
+ public function setStaticPropertyValue(string $name, $value) {}
+
+ /** @return array */
+ public function getDefaultProperties() {}
+
+ /** @return bool */
+ public function isIterable() {}
+
+ /**
+ * @return bool
+ * @alias ReflectionClass::isIterable
+ */
+ public function isIterateable() {}
+
+ /**
+ * @param string|ReflectionClass $interface
+ * @return bool
+ */
+ public function implementsInterface($interface) {}
+
+ /** @return ReflectionExtension|null */
+ public function getExtension() {}
+
+ /** @return string|false */
+ public function getExtensionName() {}
+
+ /** @return bool */
+ public function inNamespace() {}
+
+ /** @return string */
+ public function getNamespaceName() {}
+
+ /** @return string */
+ public function getShortName() {}
+}
+
+class ReflectionObject extends ReflectionClass
+{
+ public function __construct(object $argument) {}
+}
+
+class ReflectionProperty implements Reflector
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ /** @param string|object $class */
+ public function __construct($class, string $name) {}
+
+ public function __toString(): string {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return mixed */
+ public function getValue(?object $object = null) {}
+
+ /** @return void */
+ public function setValue($object_or_value, $value = UNKNOWN) {}
+
+ /** @return bool */
+ public function isInitialized(?object $object = null) {}
+
+ /** @return bool */
+ public function isPublic() {}
+
+ /** @return bool */
+ public function isPrivate() {}
+
+ /** @return bool */
+ public function isProtected() {}
+
+ /** @return bool */
+ public function isStatic() {}
+
+ /** @return bool */
+ public function isDefault() {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+
+ /** @return void */
+ public function setAccessible(bool $visible) {}
+
+ /** @return ReflectionType|null */
+ public function getType() {}
+
+ /** @return bool */
+ public function hasType() {}
+
+ public function hasDefaultValue(): bool {}
+
+ /** @return mixed */
+ public function getDefaultValue() {}
+}
+
+class ReflectionClassConstant implements Reflector
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ /** @return string|object */
+ public function __construct($class, string $name) {}
+
+ public function __toString(): string {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ /** @return mixed */
+ public function getValue() {}
+
+ /** @return bool */
+ public function isPublic() {}
+
+ /** @return bool */
+ public function isPrivate() {}
+
+ /** @return bool */
+ public function isProtected() {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+}
+
+class ReflectionParameter implements Reflector
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ /**
+ * @param string|array|object
+ * @param int|string
+ */
+ public function __construct($function, $parameter) {}
+
+ public function __toString(): string {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return bool */
+ public function isPassedByReference() {}
+
+ /** @return bool */
+ public function canBePassedByValue() {}
+
+ /** @return ReflectionFunctionAbstract */
+ public function getDeclaringFunction() {}
+
+ /** @return ReflectionClass|null */
+ public function getDeclaringClass() {}
+
+ /** @return ReflectionClass|null */
+ public function getClass() {}
+
+ /** @return bool */
+ public function hasType() {}
+
+ /** @return ReflectionType|null */
+ public function getType() {}
+
+ /** @return bool */
+ public function isArray() {}
+
+ /** @return bool */
+ public function isCallable() {}
+
+ /** @return bool */
+ public function allowsNull() {}
+
+ /** @return int */
+ public function getPosition() {}
+
+ /** @return bool */
+ public function isOptional() {}
+
+ /** @return bool */
+ public function isDefaultValueAvailable() {}
+
+ /** @return mixed */
+ public function getDefaultValue() {}
+
+ /** @return bool */
+ public function isDefaultValueConstant() {}
+
+ /** @return string|null */
+ public function getDefaultValueConstantName() {}
+
+ /** @return bool */
+ public function isVariadic() {}
+}
+
+abstract class ReflectionType implements Stringable
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ /** @return bool */
+ public function allowsNull() {}
+
+ public function __toString(): string {}
+}
+
+class ReflectionNamedType extends ReflectionType
+{
+ /** @return string */
+ public function getName() {}
+
+ /** @return bool */
+ public function isBuiltin() {}
+}
+
+class ReflectionUnionType extends ReflectionType
+{
+ public function getTypes(): array {}
+}
+
+class ReflectionExtension implements Reflector
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ public function __construct(string $name) {}
+
+ public function __toString(): string {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return string|null */
+ public function getVersion() {}
+
+ /** @return ReflectionFunction[] */
+ public function getFunctions() {}
+
+ /** @return array */
+ public function getConstants() {}
+
+ /** @return array */
+ public function getINIEntries() {}
+
+ /** @return ReflectionClass[] */
+ public function getClasses() {}
+
+ /** @return string[] */
+ public function getClassNames() {}
+
+ /** @return array */
+ public function getDependencies() {}
+
+ /** @return void */
+ public function info() {}
+
+ /** @return bool */
+ public function isPersistent() {}
+
+ /** @return bool */
+ public function isTemporary() {}
+}
+
+class ReflectionZendExtension implements Reflector
+{
+ /** @alias ReflectionClass::__clone */
+ final private function __clone() {}
+
+ public function __construct(string $name) {}
+
+ public function __toString(): string {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return string */
+ public function getVersion() {}
+
+ /** @return string */
+ public function getAuthor() {}
+
+ /** @return string */
+ public function getURL() {}
+
+ /** @return string */
+ public function getCopyright() {}
+}
+
+final class ReflectionReference
+{
+ /** @param int|string $key */
+ public static function fromArrayElement(array $array, $key): ?ReflectionReference {}
+
+ public function getId(): string {}
+
+ /** @alias ReflectionClass::__clone */
+ private function __clone() {}
+
+ private function __construct() {}
+}
diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h
new file mode 100644
index 0000000000..a0a606295b
--- /dev/null
+++ b/ext/reflection/php_reflection_arginfo.h
@@ -0,0 +1,929 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunctionAbstract___clone, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunctionAbstract_inNamespace arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_isClosure arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_isDeprecated arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_isInternal arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_isUserDefined arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_isGenerator arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_isVariadic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getClosureThis arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getClosureScopeClass arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getDocComment arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getEndLine arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getExtension arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getExtensionName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getFileName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getNamespaceName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getNumberOfParameters arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getNumberOfRequiredParameters arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getParameters arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getShortName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getStartLine arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getStaticVariables arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_returnsReference arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_hasReturnType arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionFunctionAbstract_getReturnType arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionFunction___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunction_isDisabled arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invoke, 0, 0, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invokeArgs, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunction_getClosure arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionGenerator___construct, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, generator, Generator, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionGenerator_getExecutingLine arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionGenerator_getExecutingFile arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionGenerator_getTrace, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "DEBUG_BACKTRACE_PROVIDE_OBJECT")
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionGenerator_getFunction arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionGenerator_getThis arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionGenerator_getExecutingGenerator arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, class_or_method)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionMethod_isPublic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isPrivate arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isProtected arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isAbstract arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isFinal arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isStatic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isConstructor arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_isDestructor arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_getClosure, 0, 0, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod_getModifiers arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invoke, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, object, IS_OBJECT, 1, "null")
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invokeArgs, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod_getDeclaringClass arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionMethod_getPrototype arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_setAccessible, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, visible, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, argument)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionClass_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isInternal arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isUserDefined arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isAnonymous arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isInstantiable arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isCloneable arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getFileName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getStartLine arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getEndLine arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getDocComment arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getConstructor arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_hasMethod, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getMethod arginfo_class_ReflectionClass_hasMethod
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_getMethods, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filter, IS_LONG, 1, "null")
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_hasProperty arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getProperty arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getProperties arginfo_class_ReflectionClass_getMethods
+
+#define arginfo_class_ReflectionClass_hasConstant arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getConstants arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getReflectionConstants arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getConstant arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getReflectionConstant arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getInterfaces arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getInterfaceNames arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isInterface arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getTraits arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getTraitNames arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getTraitAliases arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isTrait arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isAbstract arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isFinal arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getModifiers arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isInstance, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_newInstance arginfo_class_ReflectionFunction_invoke
+
+#define arginfo_class_ReflectionClass_newInstanceWithoutConstructor arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_newInstanceArgs, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, args, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getParentClass arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isSubclassOf, 0, 0, 1)
+ ZEND_ARG_INFO(0, class)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getStaticProperties arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_getStaticPropertyValue, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, default)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_setStaticPropertyValue, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getDefaultProperties arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isIterable arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_isIterateable arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_implementsInterface, 0, 0, 1)
+ ZEND_ARG_INFO(0, interface)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getExtension arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getExtensionName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_inNamespace arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getNamespaceName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClass_getShortName arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionObject___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, argument, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, class)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionProperty_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_getValue, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, object, IS_OBJECT, 1, "null")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_setValue, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_or_value)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty_isInitialized arginfo_class_ReflectionProperty_getValue
+
+#define arginfo_class_ReflectionProperty_isPublic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_isPrivate arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_isProtected arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_isStatic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_isDefault arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_getModifiers arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_getDeclaringClass arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_getDocComment arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_setAccessible arginfo_class_ReflectionMethod_setAccessible
+
+#define arginfo_class_ReflectionProperty_getType arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionProperty_hasType arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionProperty_hasDefaultValue, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty_getDefaultValue arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant___construct arginfo_class_ReflectionProperty___construct
+
+#define arginfo_class_ReflectionClassConstant___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionClassConstant_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_getValue arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_isPublic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_isPrivate arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_isProtected arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_getModifiers arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_getDeclaringClass arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionClassConstant_getDocComment arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, function)
+ ZEND_ARG_INFO(0, parameter)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionParameter___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionParameter_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isPassedByReference arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_canBePassedByValue arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getDeclaringFunction arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getDeclaringClass arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getClass arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_hasType arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getType arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isArray arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isCallable arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_allowsNull arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getPosition arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isOptional arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isDefaultValueAvailable arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getDefaultValue arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isDefaultValueConstant arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_getDefaultValueConstantName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionParameter_isVariadic arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionType___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionType_allowsNull arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionType___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionNamedType_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionNamedType_isBuiltin arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionUnionType_getTypes, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionExtension___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension___construct arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionExtension___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionExtension_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getVersion arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getFunctions arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getConstants arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getINIEntries arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getClasses arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getClassNames arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_getDependencies arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_info arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_isPersistent arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionExtension_isTemporary arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionZendExtension___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionZendExtension___construct arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionZendExtension___toString arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionZendExtension_getName arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionZendExtension_getVersion arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionZendExtension_getAuthor arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionZendExtension_getURL arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionZendExtension_getCopyright arginfo_class_ReflectionFunctionAbstract___clone
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_ReflectionReference_fromArrayElement, 0, 2, ReflectionReference, 1)
+ ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionReference_getId arginfo_class_ReflectionFunction___toString
+
+#define arginfo_class_ReflectionReference___clone arginfo_class_ReflectionFunctionAbstract___clone
+
+#define arginfo_class_ReflectionReference___construct arginfo_class_ReflectionFunctionAbstract___clone
+
+
+ZEND_METHOD(Reflection, getModifierNames);
+ZEND_METHOD(ReflectionClass, __clone);
+ZEND_METHOD(ReflectionFunctionAbstract, inNamespace);
+ZEND_METHOD(ReflectionFunctionAbstract, isClosure);
+ZEND_METHOD(ReflectionFunctionAbstract, isDeprecated);
+ZEND_METHOD(ReflectionFunctionAbstract, isInternal);
+ZEND_METHOD(ReflectionFunctionAbstract, isUserDefined);
+ZEND_METHOD(ReflectionFunctionAbstract, isGenerator);
+ZEND_METHOD(ReflectionFunctionAbstract, isVariadic);
+ZEND_METHOD(ReflectionFunctionAbstract, getClosureThis);
+ZEND_METHOD(ReflectionFunctionAbstract, getClosureScopeClass);
+ZEND_METHOD(ReflectionFunctionAbstract, getDocComment);
+ZEND_METHOD(ReflectionFunctionAbstract, getEndLine);
+ZEND_METHOD(ReflectionFunctionAbstract, getExtension);
+ZEND_METHOD(ReflectionFunctionAbstract, getExtensionName);
+ZEND_METHOD(ReflectionFunctionAbstract, getFileName);
+ZEND_METHOD(ReflectionFunctionAbstract, getName);
+ZEND_METHOD(ReflectionFunctionAbstract, getNamespaceName);
+ZEND_METHOD(ReflectionFunctionAbstract, getNumberOfParameters);
+ZEND_METHOD(ReflectionFunctionAbstract, getNumberOfRequiredParameters);
+ZEND_METHOD(ReflectionFunctionAbstract, getParameters);
+ZEND_METHOD(ReflectionFunctionAbstract, getShortName);
+ZEND_METHOD(ReflectionFunctionAbstract, getStartLine);
+ZEND_METHOD(ReflectionFunctionAbstract, getStaticVariables);
+ZEND_METHOD(ReflectionFunctionAbstract, returnsReference);
+ZEND_METHOD(ReflectionFunctionAbstract, hasReturnType);
+ZEND_METHOD(ReflectionFunctionAbstract, getReturnType);
+ZEND_METHOD(ReflectionFunction, __construct);
+ZEND_METHOD(ReflectionFunction, __toString);
+ZEND_METHOD(ReflectionFunction, isDisabled);
+ZEND_METHOD(ReflectionFunction, invoke);
+ZEND_METHOD(ReflectionFunction, invokeArgs);
+ZEND_METHOD(ReflectionFunction, getClosure);
+ZEND_METHOD(ReflectionGenerator, __construct);
+ZEND_METHOD(ReflectionGenerator, getExecutingLine);
+ZEND_METHOD(ReflectionGenerator, getExecutingFile);
+ZEND_METHOD(ReflectionGenerator, getTrace);
+ZEND_METHOD(ReflectionGenerator, getFunction);
+ZEND_METHOD(ReflectionGenerator, getThis);
+ZEND_METHOD(ReflectionGenerator, getExecutingGenerator);
+ZEND_METHOD(ReflectionMethod, __construct);
+ZEND_METHOD(ReflectionMethod, __toString);
+ZEND_METHOD(ReflectionMethod, isPublic);
+ZEND_METHOD(ReflectionMethod, isPrivate);
+ZEND_METHOD(ReflectionMethod, isProtected);
+ZEND_METHOD(ReflectionMethod, isAbstract);
+ZEND_METHOD(ReflectionMethod, isFinal);
+ZEND_METHOD(ReflectionMethod, isStatic);
+ZEND_METHOD(ReflectionMethod, isConstructor);
+ZEND_METHOD(ReflectionMethod, isDestructor);
+ZEND_METHOD(ReflectionMethod, getClosure);
+ZEND_METHOD(ReflectionMethod, getModifiers);
+ZEND_METHOD(ReflectionMethod, invoke);
+ZEND_METHOD(ReflectionMethod, invokeArgs);
+ZEND_METHOD(ReflectionMethod, getDeclaringClass);
+ZEND_METHOD(ReflectionMethod, getPrototype);
+ZEND_METHOD(ReflectionMethod, setAccessible);
+ZEND_METHOD(ReflectionClass, __construct);
+ZEND_METHOD(ReflectionClass, __toString);
+ZEND_METHOD(ReflectionClass, getName);
+ZEND_METHOD(ReflectionClass, isInternal);
+ZEND_METHOD(ReflectionClass, isUserDefined);
+ZEND_METHOD(ReflectionClass, isAnonymous);
+ZEND_METHOD(ReflectionClass, isInstantiable);
+ZEND_METHOD(ReflectionClass, isCloneable);
+ZEND_METHOD(ReflectionClass, getFileName);
+ZEND_METHOD(ReflectionClass, getStartLine);
+ZEND_METHOD(ReflectionClass, getEndLine);
+ZEND_METHOD(ReflectionClass, getDocComment);
+ZEND_METHOD(ReflectionClass, getConstructor);
+ZEND_METHOD(ReflectionClass, hasMethod);
+ZEND_METHOD(ReflectionClass, getMethod);
+ZEND_METHOD(ReflectionClass, getMethods);
+ZEND_METHOD(ReflectionClass, hasProperty);
+ZEND_METHOD(ReflectionClass, getProperty);
+ZEND_METHOD(ReflectionClass, getProperties);
+ZEND_METHOD(ReflectionClass, hasConstant);
+ZEND_METHOD(ReflectionClass, getConstants);
+ZEND_METHOD(ReflectionClass, getReflectionConstants);
+ZEND_METHOD(ReflectionClass, getConstant);
+ZEND_METHOD(ReflectionClass, getReflectionConstant);
+ZEND_METHOD(ReflectionClass, getInterfaces);
+ZEND_METHOD(ReflectionClass, getInterfaceNames);
+ZEND_METHOD(ReflectionClass, isInterface);
+ZEND_METHOD(ReflectionClass, getTraits);
+ZEND_METHOD(ReflectionClass, getTraitNames);
+ZEND_METHOD(ReflectionClass, getTraitAliases);
+ZEND_METHOD(ReflectionClass, isTrait);
+ZEND_METHOD(ReflectionClass, isAbstract);
+ZEND_METHOD(ReflectionClass, isFinal);
+ZEND_METHOD(ReflectionClass, getModifiers);
+ZEND_METHOD(ReflectionClass, isInstance);
+ZEND_METHOD(ReflectionClass, newInstance);
+ZEND_METHOD(ReflectionClass, newInstanceWithoutConstructor);
+ZEND_METHOD(ReflectionClass, newInstanceArgs);
+ZEND_METHOD(ReflectionClass, getParentClass);
+ZEND_METHOD(ReflectionClass, isSubclassOf);
+ZEND_METHOD(ReflectionClass, getStaticProperties);
+ZEND_METHOD(ReflectionClass, getStaticPropertyValue);
+ZEND_METHOD(ReflectionClass, setStaticPropertyValue);
+ZEND_METHOD(ReflectionClass, getDefaultProperties);
+ZEND_METHOD(ReflectionClass, isIterable);
+ZEND_METHOD(ReflectionClass, implementsInterface);
+ZEND_METHOD(ReflectionClass, getExtension);
+ZEND_METHOD(ReflectionClass, getExtensionName);
+ZEND_METHOD(ReflectionClass, inNamespace);
+ZEND_METHOD(ReflectionClass, getNamespaceName);
+ZEND_METHOD(ReflectionClass, getShortName);
+ZEND_METHOD(ReflectionObject, __construct);
+ZEND_METHOD(ReflectionProperty, __construct);
+ZEND_METHOD(ReflectionProperty, __toString);
+ZEND_METHOD(ReflectionProperty, getName);
+ZEND_METHOD(ReflectionProperty, getValue);
+ZEND_METHOD(ReflectionProperty, setValue);
+ZEND_METHOD(ReflectionProperty, isInitialized);
+ZEND_METHOD(ReflectionProperty, isPublic);
+ZEND_METHOD(ReflectionProperty, isPrivate);
+ZEND_METHOD(ReflectionProperty, isProtected);
+ZEND_METHOD(ReflectionProperty, isStatic);
+ZEND_METHOD(ReflectionProperty, isDefault);
+ZEND_METHOD(ReflectionProperty, getModifiers);
+ZEND_METHOD(ReflectionProperty, getDeclaringClass);
+ZEND_METHOD(ReflectionProperty, getDocComment);
+ZEND_METHOD(ReflectionProperty, setAccessible);
+ZEND_METHOD(ReflectionProperty, getType);
+ZEND_METHOD(ReflectionProperty, hasType);
+ZEND_METHOD(ReflectionProperty, hasDefaultValue);
+ZEND_METHOD(ReflectionProperty, getDefaultValue);
+ZEND_METHOD(ReflectionClassConstant, __construct);
+ZEND_METHOD(ReflectionClassConstant, __toString);
+ZEND_METHOD(ReflectionClassConstant, getName);
+ZEND_METHOD(ReflectionClassConstant, getValue);
+ZEND_METHOD(ReflectionClassConstant, isPublic);
+ZEND_METHOD(ReflectionClassConstant, isPrivate);
+ZEND_METHOD(ReflectionClassConstant, isProtected);
+ZEND_METHOD(ReflectionClassConstant, getModifiers);
+ZEND_METHOD(ReflectionClassConstant, getDeclaringClass);
+ZEND_METHOD(ReflectionClassConstant, getDocComment);
+ZEND_METHOD(ReflectionParameter, __construct);
+ZEND_METHOD(ReflectionParameter, __toString);
+ZEND_METHOD(ReflectionParameter, getName);
+ZEND_METHOD(ReflectionParameter, isPassedByReference);
+ZEND_METHOD(ReflectionParameter, canBePassedByValue);
+ZEND_METHOD(ReflectionParameter, getDeclaringFunction);
+ZEND_METHOD(ReflectionParameter, getDeclaringClass);
+ZEND_METHOD(ReflectionParameter, getClass);
+ZEND_METHOD(ReflectionParameter, hasType);
+ZEND_METHOD(ReflectionParameter, getType);
+ZEND_METHOD(ReflectionParameter, isArray);
+ZEND_METHOD(ReflectionParameter, isCallable);
+ZEND_METHOD(ReflectionParameter, allowsNull);
+ZEND_METHOD(ReflectionParameter, getPosition);
+ZEND_METHOD(ReflectionParameter, isOptional);
+ZEND_METHOD(ReflectionParameter, isDefaultValueAvailable);
+ZEND_METHOD(ReflectionParameter, getDefaultValue);
+ZEND_METHOD(ReflectionParameter, isDefaultValueConstant);
+ZEND_METHOD(ReflectionParameter, getDefaultValueConstantName);
+ZEND_METHOD(ReflectionParameter, isVariadic);
+ZEND_METHOD(ReflectionType, allowsNull);
+ZEND_METHOD(ReflectionType, __toString);
+ZEND_METHOD(ReflectionNamedType, getName);
+ZEND_METHOD(ReflectionNamedType, isBuiltin);
+ZEND_METHOD(ReflectionUnionType, getTypes);
+ZEND_METHOD(ReflectionExtension, __construct);
+ZEND_METHOD(ReflectionExtension, __toString);
+ZEND_METHOD(ReflectionExtension, getName);
+ZEND_METHOD(ReflectionExtension, getVersion);
+ZEND_METHOD(ReflectionExtension, getFunctions);
+ZEND_METHOD(ReflectionExtension, getConstants);
+ZEND_METHOD(ReflectionExtension, getINIEntries);
+ZEND_METHOD(ReflectionExtension, getClasses);
+ZEND_METHOD(ReflectionExtension, getClassNames);
+ZEND_METHOD(ReflectionExtension, getDependencies);
+ZEND_METHOD(ReflectionExtension, info);
+ZEND_METHOD(ReflectionExtension, isPersistent);
+ZEND_METHOD(ReflectionExtension, isTemporary);
+ZEND_METHOD(ReflectionZendExtension, __construct);
+ZEND_METHOD(ReflectionZendExtension, __toString);
+ZEND_METHOD(ReflectionZendExtension, getName);
+ZEND_METHOD(ReflectionZendExtension, getVersion);
+ZEND_METHOD(ReflectionZendExtension, getAuthor);
+ZEND_METHOD(ReflectionZendExtension, getURL);
+ZEND_METHOD(ReflectionZendExtension, getCopyright);
+ZEND_METHOD(ReflectionReference, fromArrayElement);
+ZEND_METHOD(ReflectionReference, getId);
+ZEND_METHOD(ReflectionReference, __construct);
+
+
+static const zend_function_entry class_ReflectionException_methods[] = {
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_Reflection_methods[] = {
+ ZEND_ME(Reflection, getModifierNames, arginfo_class_Reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_Reflector_methods[] = {
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionFunctionAbstract_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionFunctionAbstract___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionFunctionAbstract, inNamespace, arginfo_class_ReflectionFunctionAbstract_inNamespace, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, isClosure, arginfo_class_ReflectionFunctionAbstract_isClosure, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, isDeprecated, arginfo_class_ReflectionFunctionAbstract_isDeprecated, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, isInternal, arginfo_class_ReflectionFunctionAbstract_isInternal, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, isUserDefined, arginfo_class_ReflectionFunctionAbstract_isUserDefined, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, isGenerator, arginfo_class_ReflectionFunctionAbstract_isGenerator, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, isVariadic, arginfo_class_ReflectionFunctionAbstract_isVariadic, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getClosureThis, arginfo_class_ReflectionFunctionAbstract_getClosureThis, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getClosureScopeClass, arginfo_class_ReflectionFunctionAbstract_getClosureScopeClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getDocComment, arginfo_class_ReflectionFunctionAbstract_getDocComment, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getEndLine, arginfo_class_ReflectionFunctionAbstract_getEndLine, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getExtension, arginfo_class_ReflectionFunctionAbstract_getExtension, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getExtensionName, arginfo_class_ReflectionFunctionAbstract_getExtensionName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getFileName, arginfo_class_ReflectionFunctionAbstract_getFileName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getName, arginfo_class_ReflectionFunctionAbstract_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getNamespaceName, arginfo_class_ReflectionFunctionAbstract_getNamespaceName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getNumberOfParameters, arginfo_class_ReflectionFunctionAbstract_getNumberOfParameters, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getNumberOfRequiredParameters, arginfo_class_ReflectionFunctionAbstract_getNumberOfRequiredParameters, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getParameters, arginfo_class_ReflectionFunctionAbstract_getParameters, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getShortName, arginfo_class_ReflectionFunctionAbstract_getShortName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getStartLine, arginfo_class_ReflectionFunctionAbstract_getStartLine, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getStaticVariables, arginfo_class_ReflectionFunctionAbstract_getStaticVariables, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, returnsReference, arginfo_class_ReflectionFunctionAbstract_returnsReference, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, hasReturnType, arginfo_class_ReflectionFunctionAbstract_hasReturnType, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunctionAbstract, getReturnType, arginfo_class_ReflectionFunctionAbstract_getReturnType, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionFunction_methods[] = {
+ ZEND_ME(ReflectionFunction, __construct, arginfo_class_ReflectionFunction___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunction, __toString, arginfo_class_ReflectionFunction___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunction, isDisabled, arginfo_class_ReflectionFunction_isDisabled, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunction, invoke, arginfo_class_ReflectionFunction_invoke, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunction, invokeArgs, arginfo_class_ReflectionFunction_invokeArgs, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionFunction, getClosure, arginfo_class_ReflectionFunction_getClosure, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionGenerator_methods[] = {
+ ZEND_ME(ReflectionGenerator, __construct, arginfo_class_ReflectionGenerator___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionGenerator, getExecutingLine, arginfo_class_ReflectionGenerator_getExecutingLine, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionGenerator, getExecutingFile, arginfo_class_ReflectionGenerator_getExecutingFile, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionGenerator, getTrace, arginfo_class_ReflectionGenerator_getTrace, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionGenerator, getFunction, arginfo_class_ReflectionGenerator_getFunction, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionGenerator, getThis, arginfo_class_ReflectionGenerator_getThis, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionGenerator, getExecutingGenerator, arginfo_class_ReflectionGenerator_getExecutingGenerator, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionMethod_methods[] = {
+ ZEND_ME(ReflectionMethod, __construct, arginfo_class_ReflectionMethod___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, __toString, arginfo_class_ReflectionMethod___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isPublic, arginfo_class_ReflectionMethod_isPublic, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isPrivate, arginfo_class_ReflectionMethod_isPrivate, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isProtected, arginfo_class_ReflectionMethod_isProtected, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isAbstract, arginfo_class_ReflectionMethod_isAbstract, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isFinal, arginfo_class_ReflectionMethod_isFinal, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isStatic, arginfo_class_ReflectionMethod_isStatic, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isConstructor, arginfo_class_ReflectionMethod_isConstructor, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, isDestructor, arginfo_class_ReflectionMethod_isDestructor, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, getClosure, arginfo_class_ReflectionMethod_getClosure, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, getModifiers, arginfo_class_ReflectionMethod_getModifiers, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, invoke, arginfo_class_ReflectionMethod_invoke, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, invokeArgs, arginfo_class_ReflectionMethod_invokeArgs, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, getDeclaringClass, arginfo_class_ReflectionMethod_getDeclaringClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, getPrototype, arginfo_class_ReflectionMethod_getPrototype, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionMethod, setAccessible, arginfo_class_ReflectionMethod_setAccessible, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionClass_methods[] = {
+ ZEND_ME(ReflectionClass, __clone, arginfo_class_ReflectionClass___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionClass, __construct, arginfo_class_ReflectionClass___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, __toString, arginfo_class_ReflectionClass___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getName, arginfo_class_ReflectionClass_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isInternal, arginfo_class_ReflectionClass_isInternal, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isUserDefined, arginfo_class_ReflectionClass_isUserDefined, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isAnonymous, arginfo_class_ReflectionClass_isAnonymous, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isInstantiable, arginfo_class_ReflectionClass_isInstantiable, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isCloneable, arginfo_class_ReflectionClass_isCloneable, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getFileName, arginfo_class_ReflectionClass_getFileName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getStartLine, arginfo_class_ReflectionClass_getStartLine, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getEndLine, arginfo_class_ReflectionClass_getEndLine, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getDocComment, arginfo_class_ReflectionClass_getDocComment, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getConstructor, arginfo_class_ReflectionClass_getConstructor, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, hasMethod, arginfo_class_ReflectionClass_hasMethod, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getMethod, arginfo_class_ReflectionClass_getMethod, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getMethods, arginfo_class_ReflectionClass_getMethods, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, hasProperty, arginfo_class_ReflectionClass_hasProperty, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getProperty, arginfo_class_ReflectionClass_getProperty, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getProperties, arginfo_class_ReflectionClass_getProperties, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, hasConstant, arginfo_class_ReflectionClass_hasConstant, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getConstants, arginfo_class_ReflectionClass_getConstants, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getReflectionConstants, arginfo_class_ReflectionClass_getReflectionConstants, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getConstant, arginfo_class_ReflectionClass_getConstant, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getReflectionConstant, arginfo_class_ReflectionClass_getReflectionConstant, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getInterfaces, arginfo_class_ReflectionClass_getInterfaces, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getInterfaceNames, arginfo_class_ReflectionClass_getInterfaceNames, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isInterface, arginfo_class_ReflectionClass_isInterface, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getTraits, arginfo_class_ReflectionClass_getTraits, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getTraitNames, arginfo_class_ReflectionClass_getTraitNames, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getTraitAliases, arginfo_class_ReflectionClass_getTraitAliases, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isTrait, arginfo_class_ReflectionClass_isTrait, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isAbstract, arginfo_class_ReflectionClass_isAbstract, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isFinal, arginfo_class_ReflectionClass_isFinal, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getModifiers, arginfo_class_ReflectionClass_getModifiers, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isInstance, arginfo_class_ReflectionClass_isInstance, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, newInstance, arginfo_class_ReflectionClass_newInstance, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, newInstanceWithoutConstructor, arginfo_class_ReflectionClass_newInstanceWithoutConstructor, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, newInstanceArgs, arginfo_class_ReflectionClass_newInstanceArgs, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getParentClass, arginfo_class_ReflectionClass_getParentClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isSubclassOf, arginfo_class_ReflectionClass_isSubclassOf, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getStaticProperties, arginfo_class_ReflectionClass_getStaticProperties, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getStaticPropertyValue, arginfo_class_ReflectionClass_getStaticPropertyValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, setStaticPropertyValue, arginfo_class_ReflectionClass_setStaticPropertyValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getDefaultProperties, arginfo_class_ReflectionClass_getDefaultProperties, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, isIterable, arginfo_class_ReflectionClass_isIterable, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(ReflectionClass, isIterateable, isIterable, arginfo_class_ReflectionClass_isIterateable, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, implementsInterface, arginfo_class_ReflectionClass_implementsInterface, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getExtension, arginfo_class_ReflectionClass_getExtension, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getExtensionName, arginfo_class_ReflectionClass_getExtensionName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, inNamespace, arginfo_class_ReflectionClass_inNamespace, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getNamespaceName, arginfo_class_ReflectionClass_getNamespaceName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClass, getShortName, arginfo_class_ReflectionClass_getShortName, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionObject_methods[] = {
+ ZEND_ME(ReflectionObject, __construct, arginfo_class_ReflectionObject___construct, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionProperty_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionProperty___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionProperty, __construct, arginfo_class_ReflectionProperty___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, __toString, arginfo_class_ReflectionProperty___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getName, arginfo_class_ReflectionProperty_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getValue, arginfo_class_ReflectionProperty_getValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, setValue, arginfo_class_ReflectionProperty_setValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, isInitialized, arginfo_class_ReflectionProperty_isInitialized, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, isPublic, arginfo_class_ReflectionProperty_isPublic, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, isPrivate, arginfo_class_ReflectionProperty_isPrivate, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, isProtected, arginfo_class_ReflectionProperty_isProtected, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, isStatic, arginfo_class_ReflectionProperty_isStatic, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, isDefault, arginfo_class_ReflectionProperty_isDefault, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getModifiers, arginfo_class_ReflectionProperty_getModifiers, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getDeclaringClass, arginfo_class_ReflectionProperty_getDeclaringClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getDocComment, arginfo_class_ReflectionProperty_getDocComment, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, setAccessible, arginfo_class_ReflectionProperty_setAccessible, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getType, arginfo_class_ReflectionProperty_getType, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, hasType, arginfo_class_ReflectionProperty_hasType, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, hasDefaultValue, arginfo_class_ReflectionProperty_hasDefaultValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionProperty, getDefaultValue, arginfo_class_ReflectionProperty_getDefaultValue, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionClassConstant_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionClassConstant___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionClassConstant, __construct, arginfo_class_ReflectionClassConstant___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, __toString, arginfo_class_ReflectionClassConstant___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, getName, arginfo_class_ReflectionClassConstant_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, getValue, arginfo_class_ReflectionClassConstant_getValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, isPublic, arginfo_class_ReflectionClassConstant_isPublic, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, isPrivate, arginfo_class_ReflectionClassConstant_isPrivate, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, isProtected, arginfo_class_ReflectionClassConstant_isProtected, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, getModifiers, arginfo_class_ReflectionClassConstant_getModifiers, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, getDeclaringClass, arginfo_class_ReflectionClassConstant_getDeclaringClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionClassConstant, getDocComment, arginfo_class_ReflectionClassConstant_getDocComment, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionParameter_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionParameter___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionParameter, __construct, arginfo_class_ReflectionParameter___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, __toString, arginfo_class_ReflectionParameter___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getName, arginfo_class_ReflectionParameter_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isPassedByReference, arginfo_class_ReflectionParameter_isPassedByReference, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, canBePassedByValue, arginfo_class_ReflectionParameter_canBePassedByValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getDeclaringFunction, arginfo_class_ReflectionParameter_getDeclaringFunction, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getDeclaringClass, arginfo_class_ReflectionParameter_getDeclaringClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getClass, arginfo_class_ReflectionParameter_getClass, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, hasType, arginfo_class_ReflectionParameter_hasType, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getType, arginfo_class_ReflectionParameter_getType, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isArray, arginfo_class_ReflectionParameter_isArray, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isCallable, arginfo_class_ReflectionParameter_isCallable, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, allowsNull, arginfo_class_ReflectionParameter_allowsNull, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getPosition, arginfo_class_ReflectionParameter_getPosition, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isOptional, arginfo_class_ReflectionParameter_isOptional, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isDefaultValueAvailable, arginfo_class_ReflectionParameter_isDefaultValueAvailable, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getDefaultValue, arginfo_class_ReflectionParameter_getDefaultValue, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isDefaultValueConstant, arginfo_class_ReflectionParameter_isDefaultValueConstant, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, getDefaultValueConstantName, arginfo_class_ReflectionParameter_getDefaultValueConstantName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionParameter, isVariadic, arginfo_class_ReflectionParameter_isVariadic, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionType_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionType___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionType, allowsNull, arginfo_class_ReflectionType_allowsNull, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionType, __toString, arginfo_class_ReflectionType___toString, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionNamedType_methods[] = {
+ ZEND_ME(ReflectionNamedType, getName, arginfo_class_ReflectionNamedType_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionNamedType, isBuiltin, arginfo_class_ReflectionNamedType_isBuiltin, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionUnionType_methods[] = {
+ ZEND_ME(ReflectionUnionType, getTypes, arginfo_class_ReflectionUnionType_getTypes, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionExtension_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionExtension, __construct, arginfo_class_ReflectionExtension___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, __toString, arginfo_class_ReflectionExtension___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getName, arginfo_class_ReflectionExtension_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getVersion, arginfo_class_ReflectionExtension_getVersion, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getFunctions, arginfo_class_ReflectionExtension_getFunctions, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getConstants, arginfo_class_ReflectionExtension_getConstants, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getINIEntries, arginfo_class_ReflectionExtension_getINIEntries, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getClasses, arginfo_class_ReflectionExtension_getClasses, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getClassNames, arginfo_class_ReflectionExtension_getClassNames, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, getDependencies, arginfo_class_ReflectionExtension_getDependencies, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, info, arginfo_class_ReflectionExtension_info, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, isPersistent, arginfo_class_ReflectionExtension_isPersistent, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionExtension, isTemporary, arginfo_class_ReflectionExtension_isTemporary, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionZendExtension_methods[] = {
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionZendExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(ReflectionZendExtension, __construct, arginfo_class_ReflectionZendExtension___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionZendExtension, __toString, arginfo_class_ReflectionZendExtension___toString, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionZendExtension, getName, arginfo_class_ReflectionZendExtension_getName, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionZendExtension, getVersion, arginfo_class_ReflectionZendExtension_getVersion, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionZendExtension, getAuthor, arginfo_class_ReflectionZendExtension_getAuthor, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionZendExtension, getURL, arginfo_class_ReflectionZendExtension_getURL, ZEND_ACC_PUBLIC)
+ ZEND_ME(ReflectionZendExtension, getCopyright, arginfo_class_ReflectionZendExtension_getCopyright, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+
+static const zend_function_entry class_ReflectionReference_methods[] = {
+ ZEND_ME(ReflectionReference, fromArrayElement, arginfo_class_ReflectionReference_fromArrayElement, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(ReflectionReference, getId, arginfo_class_ReflectionReference_getId, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(ReflectionClass, __clone, __clone, arginfo_class_ReflectionReference___clone, ZEND_ACC_PRIVATE)
+ ZEND_ME(ReflectionReference, __construct, arginfo_class_ReflectionReference___construct, ZEND_ACC_PRIVATE)
+ ZEND_FE_END
+};
diff --git a/ext/reflection/tests/001.phpt b/ext/reflection/tests/001.phpt
index f68afc950e..7812679ba7 100644
--- a/ext/reflection/tests/001.phpt
+++ b/ext/reflection/tests/001.phpt
@@ -5,24 +5,23 @@ Reflection inheritance
class ReflectionClassEx extends ReflectionClass
{
- public $bla;
+ public $bla;
- function getMethodNames()
- {
- $res = array();
- foreach($this->getMethods() as $m)
- {
- $res[] = $m->class . '::' . $m->name;
- }
- return $res;
- }
+ function getMethodNames()
+ {
+ $res = array();
+ foreach($this->getMethods() as $m)
+ {
+ $res[] = $m->class . '::' . $m->name;
+ }
+ return $res;
+ }
}
$r = new ReflectionClassEx('ReflectionClassEx');
$exp = array (
'UMLClass::__clone',
- 'UMLClass::export',
'UMLClass::__construct',
'UMLClass::__toString',
'UMLClass::getName',
@@ -62,10 +61,10 @@ $res = $r->getMethodNames();
foreach($exp as $m)
{
- if (!in_array($m, $exp))
- {
- $miss[] = $m;
- }
+ if (!in_array($m, $exp))
+ {
+ $miss[] = $m;
+ }
}
var_dump($miss);
@@ -75,7 +74,6 @@ sort($props);
var_dump($props);
var_dump($r->name);
?>
-===DONE===
--EXPECT--
array(0) {
}
@@ -86,4 +84,3 @@ array(2) {
string(4) "name"
}
string(17) "ReflectionClassEx"
-===DONE===
diff --git a/ext/reflection/tests/002.phpt b/ext/reflection/tests/002.phpt
index d0fcb32bea..b10013d2a9 100644
--- a/ext/reflection/tests/002.phpt
+++ b/ext/reflection/tests/002.phpt
@@ -5,13 +5,13 @@ Reflection properties are read only
class ReflectionMethodEx extends ReflectionMethod
{
- public $foo = "xyz";
+ public $foo = "xyz";
- function __construct($c,$m)
- {
- echo __METHOD__ . "\n";
- parent::__construct($c,$m);
- }
+ function __construct($c,$m)
+ {
+ echo __METHOD__ . "\n";
+ parent::__construct($c,$m);
+ }
}
$r = new ReflectionMethodEx('ReflectionMethodEx','getName');
@@ -23,11 +23,11 @@ var_dump($r->foo);
try
{
- $r->class = 'bullshit';
+ $r->class = 'bullshit';
}
catch(ReflectionException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try
{
@@ -35,7 +35,7 @@ $r->name = 'bullshit';
}
catch(ReflectionException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$r->foo = 'bar';
@@ -47,7 +47,6 @@ var_dump($r->foo);
var_dump($r->bar);
?>
-===DONE===
--EXPECT--
ReflectionMethodEx::__construct
string(26) "ReflectionFunctionAbstract"
@@ -60,4 +59,3 @@ string(26) "ReflectionFunctionAbstract"
string(7) "getName"
string(3) "bar"
string(3) "baz"
-===DONE===
diff --git a/ext/reflection/tests/003.phpt b/ext/reflection/tests/003.phpt
index 80bf0a6513..dbafebfb8d 100644
--- a/ext/reflection/tests/003.phpt
+++ b/ext/reflection/tests/003.phpt
@@ -5,18 +5,18 @@ ReflectionMethod::invoke() with base class method
class Foo
{
- function Test()
- {
- echo __METHOD__ . "\n";
- }
+ function Test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class Bar extends Foo
{
- function Test()
- {
- echo __METHOD__ . "\n";
- }
+ function Test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
$o = new Bar;
@@ -25,7 +25,5 @@ $r = new ReflectionMethod('Foo','Test');
$r->invoke($o);
?>
-===DONE===
--EXPECT--
Foo::Test
-===DONE===
diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt
index 36ae406b43..3739d2e55c 100644
--- a/ext/reflection/tests/004.phpt
+++ b/ext/reflection/tests/004.phpt
@@ -4,8 +4,8 @@ ReflectionMethod::invoke() with non object or null value
<?php
class a {
- function a(){
- }
+ function __construct(){
+ }
}
class b {
}
@@ -13,7 +13,7 @@ class b {
$b = new b();
$a=new ReflectionClass("a");
-$m=$a->getMethod("a");
+$m=$a->getMethod("__construct");
try {
$m->invoke(null);
@@ -35,9 +35,7 @@ try {
echo $E->getMessage()."\n";
}
-echo "===DONE===\n";?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d
-Trying to invoke non static method a::a() without an object
+?>
+--EXPECT--
+Trying to invoke non static method a::__construct() without an object
Given object is not an instance of the class this method was declared in
-===DONE===
diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt
index e40fcc3099..58411f98c8 100644
--- a/ext/reflection/tests/005.phpt
+++ b/ext/reflection/tests/005.phpt
@@ -7,18 +7,18 @@ opcache.save_comments=1
function strip_doc_comment($c)
{
- if (!strlen($c) || $c === false) return $c;
- return trim(substr($c, 3, -2));
+ if (!strlen($c) || $c === false) return $c;
+ return trim(substr($c, 3, -2));
}
/** Comment for class A */
class A
{
- /** Method A::bla()
- */
- function bla()
- {
- }
+ /** Method A::bla()
+ */
+ function bla()
+ {
+ }
function foo() {
/**
@@ -42,15 +42,13 @@ var_dump(strip_doc_comment($r->getDocComment()));
foreach($r->getMethods() as $m)
{
- var_dump(strip_doc_comment($m->getDocComment()));
+ var_dump(strip_doc_comment($m->getDocComment()));
}
?>
-===DONE===
--EXPECT--
string(19) "Comment for class A"
string(15) "Method A::bla()"
bool(false)
bool(false)
string(22) "* Comment for A::baz()"
-===DONE===
diff --git a/ext/reflection/tests/006.phpt b/ext/reflection/tests/006.phpt
index ab22f5c5c9..c21aa5af8b 100644
--- a/ext/reflection/tests/006.phpt
+++ b/ext/reflection/tests/006.phpt
@@ -9,81 +9,79 @@ ReflectionClass::[gs]etStaticPropertyValue
Class Test
{
- static public $pub = 'pub';
- static protected $pro = 'pro';
- static private $pri = 'pri';
+ static public $pub = 'pub';
+ static protected $pro = 'pro';
+ static private $pri = 'pri';
- static function testing()
- {
- $ref = new ReflectionClass('Test');
+ static function testing()
+ {
+ $ref = new ReflectionClass('Test');
- foreach(array('pub', 'pro', 'pri') as $name)
- {
- try
- {
- var_dump($ref->getStaticPropertyValue($name));
- var_dump($ref->getStaticPropertyValue($name));
- $ref->setStaticPropertyValue($name, 'updated');
- var_dump($ref->getStaticPropertyValue($name));
- }
- catch(Exception $e)
- {
- echo "EXCEPTION\n";
- }
- }
- }
+ foreach(array('pub', 'pro', 'pri') as $name)
+ {
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+ }
+ }
}
Class TestDerived extends Test
{
// static public $pub = 'pub';
// static protected $pro = 'pro';
- static private $pri = 'pri';
+ static private $pri = 'pri';
- static function testing()
- {
- $ref = new ReflectionClass('Test');
+ static function testing()
+ {
+ $ref = new ReflectionClass('Test');
- foreach(array('pub', 'pro', 'pri') as $name)
- {
- try
- {
- var_dump($ref->getStaticPropertyValue($name));
- var_dump($ref->getStaticPropertyValue($name));
- $ref->setStaticPropertyValue($name, 'updated');
- var_dump($ref->getStaticPropertyValue($name));
- }
- catch(Exception $e)
- {
- echo "EXCEPTION\n";
- }
- }
- }
+ foreach(array('pub', 'pro', 'pri') as $name)
+ {
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+ }
+ }
}
$ref = new ReflectionClass('Test');
foreach(array('pub', 'pro', 'pri') as $name)
{
- try
- {
- var_dump($ref->getStaticPropertyValue($name));
- var_dump($ref->getStaticPropertyValue($name));
- $ref->setStaticPropertyValue($name, 'updated');
- var_dump($ref->getStaticPropertyValue($name));
- }
- catch(Exception $e)
- {
- echo "EXCEPTION\n";
- }
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
}
Test::testing();
TestDerived::testing();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
string(3) "pub"
string(3) "pub"
@@ -100,4 +98,3 @@ string(7) "updated"
string(7) "updated"
EXCEPTION
EXCEPTION
-===DONE===
diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt
index 8babf24282..df1d97eea9 100644
--- a/ext/reflection/tests/007.phpt
+++ b/ext/reflection/tests/007.phpt
@@ -5,56 +5,56 @@ ReflectionClass::newInstance[Args]
function test($class)
{
- echo "====>$class\n";
- try
- {
- $ref = new ReflectionClass($class);
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- return; // only here
- }
-
- echo "====>newInstance()\n";
- try
- {
- var_dump($ref->newInstance());
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- }
- catch (Throwable $e)
- {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- echo "====>newInstance(25)\n";
- try
- {
- var_dump($ref->newInstance(25));
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- }
-
- echo "====>newInstance(25, 42)\n";
- try
- {
- var_dump($ref->newInstance(25, 42));
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- }
-
- echo "\n";
+ echo "====>$class\n";
+ try
+ {
+ $ref = new ReflectionClass($class);
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ return; // only here
+ }
+
+ echo "====>newInstance()\n";
+ try
+ {
+ var_dump($ref->newInstance());
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ }
+ catch (Throwable $e)
+ {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ echo "====>newInstance(25)\n";
+ try
+ {
+ var_dump($ref->newInstance(25));
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ }
+
+ echo "====>newInstance(25, 42)\n";
+ try
+ {
+ var_dump($ref->newInstance(25, 42));
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ }
+
+ echo "\n";
}
spl_autoload_register(function ($class) {
- echo __FUNCTION__ . "($class)\n";
+ echo __FUNCTION__ . "($class)\n";
});
test('Class_does_not_exist');
@@ -67,29 +67,27 @@ test('NoCtor');
Class WithCtor
{
- function __construct()
- {
- echo __METHOD__ . "()\n";
- var_dump(func_get_args());
- }
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump(func_get_args());
+ }
}
test('WithCtor');
Class WithCtorWithArgs
{
- function __construct($arg)
- {
- echo __METHOD__ . "($arg)\n";
- var_dump(func_get_args());
- }
+ function __construct($arg)
+ {
+ echo __METHOD__ . "($arg)\n";
+ var_dump(func_get_args());
+ }
}
test('WithCtorWithArgs');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
====>Class_does_not_exist
{closure}(Class_does_not_exist)
@@ -151,4 +149,3 @@ array(2) {
object(WithCtorWithArgs)#%d (0) {
}
-===DONE===
diff --git a/ext/reflection/tests/008.phpt b/ext/reflection/tests/008.phpt
index 80a4a39218..0b9a867884 100644
--- a/ext/reflection/tests/008.phpt
+++ b/ext/reflection/tests/008.phpt
@@ -6,34 +6,34 @@ ReflectionMethod::__construct() tests
$a = array("", 1, "::", "a::", "::b", "a::b");
foreach ($a as $val) {
- try {
- new ReflectionMethod($val);
- } catch (Exception $e) {
- var_dump($e->getMessage());
- }
+ try {
+ new ReflectionMethod($val);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ }
}
$a = array("", 1, "");
$b = array("", "", 1);
foreach ($a as $key=>$val) {
- try {
- new ReflectionMethod($val, $b[$key]);
- } catch (Exception $e) {
- var_dump($e->getMessage());
- }
+ try {
+ new ReflectionMethod($val, $b[$key]);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ }
}
echo "Done\n";
?>
--EXPECT--
-string(20) "Invalid method name "
-string(21) "Invalid method name 1"
+string(91) "ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name"
+string(91) "ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name"
string(21) "Class does not exist"
string(22) "Class a does not exist"
string(21) "Class does not exist"
string(22) "Class a does not exist"
string(21) "Class does not exist"
-string(66) "The parameter class is expected to be either a string or an object"
+string(104) "ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be of type object|string, int given"
string(21) "Class does not exist"
Done
diff --git a/ext/reflection/tests/009.phpt b/ext/reflection/tests/009.phpt
index d582623cbd..8a57ed9d1d 100644
--- a/ext/reflection/tests/009.phpt
+++ b/ext/reflection/tests/009.phpt
@@ -9,7 +9,7 @@ opcache.save_comments=1
hoho
*/
function test ($a, $b = 1, $c = "") {
- static $var = 1;
+ static $var = 1;
}
$func = new ReflectionFunction("test");
diff --git a/ext/reflection/tests/010.phpt b/ext/reflection/tests/010.phpt
index 8345dc35bf..ae1e4dff0b 100644
--- a/ext/reflection/tests/010.phpt
+++ b/ext/reflection/tests/010.phpt
@@ -1,14 +1,14 @@
--TEST--
-ReflectionMethod::__toString() tests (overriden method)
+ReflectionMethod::__toString() tests (overridden method)
--FILE--
<?php
class Foo {
- function func() {
- }
+ function func() {
+ }
}
class Bar extends Foo {
- function func() {
- }
+ function func() {
+ }
}
$m = new ReflectionMethod("Bar::func");
echo $m;
diff --git a/ext/reflection/tests/012.phpt b/ext/reflection/tests/012.phpt
index d2d1c5f384..4eeeb98f3d 100644
--- a/ext/reflection/tests/012.phpt
+++ b/ext/reflection/tests/012.phpt
@@ -3,7 +3,7 @@ ReflectionClass::getDefaultProperties()
--FILE--
<?php
class Foo {
- public $test = "ok";
+ public $test = "ok";
}
$class = new ReflectionClass("Foo");
$props = $class->getDefaultProperties();
diff --git a/ext/reflection/tests/017.phpt b/ext/reflection/tests/017.phpt
index 322065bf20..be306b53c6 100644
--- a/ext/reflection/tests/017.phpt
+++ b/ext/reflection/tests/017.phpt
@@ -3,7 +3,7 @@ ReflectionClass::__toString() (constants)
--FILE--
<?php
class Foo {
- const test = "ok";
+ const test = "ok";
}
$class = new ReflectionClass("Foo");
echo $class;
diff --git a/ext/reflection/tests/020.phpt b/ext/reflection/tests/020.phpt
index 13ae6fe275..491eed7d1f 100644
--- a/ext/reflection/tests/020.phpt
+++ b/ext/reflection/tests/020.phpt
@@ -3,14 +3,14 @@ ReflectionObject::hasProperty
--FILE--
<?php
class Foo {
- public $p1;
- protected $p2;
- private $p3;
+ public $p1;
+ protected $p2;
+ private $p3;
- function __isset($name) {
- var_dump($name);
- return false;
- }
+ function __isset($name) {
+ var_dump($name);
+ return false;
+ }
}
$obj = new ReflectionObject(new Foo());
var_dump($obj->hasProperty("p1"));
diff --git a/ext/reflection/tests/021.phpt b/ext/reflection/tests/021.phpt
index 42d11cc445..fefcf34e78 100644
--- a/ext/reflection/tests/021.phpt
+++ b/ext/reflection/tests/021.phpt
@@ -3,7 +3,7 @@ ReflectionClass::hasConstant
--FILE--
<?php
class Foo {
- const c1 = 1;
+ const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->hasConstant("c1"));
diff --git a/ext/reflection/tests/022.phpt b/ext/reflection/tests/022.phpt
index 2cfd603dad..4a6738f97c 100644
--- a/ext/reflection/tests/022.phpt
+++ b/ext/reflection/tests/022.phpt
@@ -3,7 +3,7 @@ ReflectionClass::getConstant
--FILE--
<?php
class Foo {
- const c1 = 1;
+ const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->getConstant("c1"));
diff --git a/ext/reflection/tests/023.phpt b/ext/reflection/tests/023.phpt
index fe10b2531a..7f8c500015 100644
--- a/ext/reflection/tests/023.phpt
+++ b/ext/reflection/tests/023.phpt
@@ -3,14 +3,14 @@ ReflectionClass::getDefaultProperties (filtering parent privates)
--FILE--
<?php
class C1 {
- private $p1 = 1;
- protected $p2 = 2;
- public $p3 = 3;
+ private $p1 = 1;
+ protected $p2 = 2;
+ public $p3 = 3;
}
class C2 extends C1 {
- private $p4 = 4;
- protected $p5 = 5;
- public $p6 = 6;
+ private $p4 = 4;
+ protected $p5 = 5;
+ public $p6 = 6;
}
$class = new ReflectionClass("C2");
var_dump($class->getDefaultProperties());
diff --git a/ext/reflection/tests/024.phpt b/ext/reflection/tests/024.phpt
index 2b894d3f31..46db75c911 100644
--- a/ext/reflection/tests/024.phpt
+++ b/ext/reflection/tests/024.phpt
@@ -3,9 +3,9 @@ ReflectionObject::__toString (filtering privates/protected dynamic properties)
--FILE--
<?php
class C1 {
- private $p1 = 1;
- protected $p2 = 2;
- public $p3 = 3;
+ private $p1 = 1;
+ protected $p2 = 2;
+ public $p3 = 3;
}
$x = new C1();
@@ -29,9 +29,9 @@ Object of class [ <user> class C1 ] {
}
- Properties [3] {
- Property [ <default> private $p1 ]
- Property [ <default> protected $p2 ]
- Property [ <default> public $p3 ]
+ Property [ private $p1 = 1 ]
+ Property [ protected $p2 = 2 ]
+ Property [ public $p3 = 3 ]
}
- Dynamic properties [1] {
diff --git a/ext/reflection/tests/025.phpt b/ext/reflection/tests/025.phpt
index c18a0f5b8e..2e3316d3c0 100644
--- a/ext/reflection/tests/025.phpt
+++ b/ext/reflection/tests/025.phpt
@@ -9,7 +9,7 @@ opcache.save_comments=1
hoho
*/
function test ($a, $b = 1, $c = "") {
- static $var = 1;
+ static $var = 1;
}
$func = new ReflectionFunction("test");
diff --git a/ext/reflection/tests/027.phpt b/ext/reflection/tests/027.phpt
index e750682ab6..add38f1476 100644
--- a/ext/reflection/tests/027.phpt
+++ b/ext/reflection/tests/027.phpt
@@ -4,7 +4,7 @@ ReflectionGenerator::getTrace()
<?php
function foo()
{
- yield 1;
+ yield 1;
}
$g = foo();
@@ -13,9 +13,9 @@ $r = new ReflectionGenerator($g);
$g->next();
try {
- $r->getTrace();
+ $r->getTrace();
} catch (ReflectionException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/028.phpt b/ext/reflection/tests/028.phpt
index ed6950fce3..bf16785c18 100644
--- a/ext/reflection/tests/028.phpt
+++ b/ext/reflection/tests/028.phpt
@@ -4,16 +4,16 @@ ReflectionGenerator::__construct()
<?php
function foo()
{
- yield 1;
+ yield 1;
}
$g = foo();
$g->next();
try {
- $r = new ReflectionGenerator($g);
+ $r = new ReflectionGenerator($g);
} catch (ReflectionException $e) {
- echo "Done!\n";
+ echo "Done!\n";
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt
index 181360d733..414fac8543 100644
--- a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt
+++ b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test usage of ReflectionClassConstant methods __toString(), export(), getName(), getValue(), isPublic(), isPrivate(), isProtected(), getModifiers(), getDeclaringClass() and getDocComment().
+Test usage of ReflectionClassConstant methods __toString(), getName(), getValue(), isPublic(), isPrivate(), isProtected(), getModifiers(), getDeclaringClass() and getDocComment().
--FILE--
<?php
@@ -10,10 +10,6 @@ function reflectClassConstant($base, $constant) {
echo "Reflecting on class constant $class::$constant\n\n";
echo "__toString():\n";
var_dump($constInfo->__toString());
- echo "export():\n";
- var_dump(ReflectionClassConstant::export($base, $constant, true));
- echo "export():\n";
- var_dump(ReflectionClassConstant::export($base, $constant, false));
echo "getName():\n";
var_dump($constInfo->getName());
echo "getValue():\n";
@@ -55,17 +51,6 @@ Reflecting on class constant TestClass::PUB
__toString():
string(35) "Constant [ public bool PUB ] { 1 }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(35) "Constant [ public bool PUB ] { 1 }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ public bool PUB ] { 1 }
-
-NULL
getName():
string(3) "PUB"
getValue():
@@ -93,17 +78,6 @@ Reflecting on class constant TestClass::PROT
__toString():
string(38) "Constant [ protected int PROT ] { 4 }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(38) "Constant [ protected int PROT ] { 4 }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ protected int PROT ] { 4 }
-
-NULL
getName():
string(4) "PROT"
getValue():
@@ -131,17 +105,6 @@ Reflecting on class constant TestClass::PRIV
__toString():
string(45) "Constant [ private string PRIV ] { keepOut }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(45) "Constant [ private string PRIV ] { keepOut }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ private string PRIV ] { keepOut }
-
-NULL
getName():
string(4) "PRIV"
getValue():
@@ -169,17 +132,6 @@ Reflecting on class constant TestClass::PRIV
__toString():
string(45) "Constant [ private string PRIV ] { keepOut }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(45) "Constant [ private string PRIV ] { keepOut }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ private string PRIV ] { keepOut }
-
-NULL
getName():
string(4) "PRIV"
getValue():
diff --git a/ext/reflection/tests/ReflectionClass_constructor_001.phpt b/ext/reflection/tests/ReflectionClass_constructor_001.phpt
index 1a70fe1f59..0d4fa670c3 100644
--- a/ext/reflection/tests/ReflectionClass_constructor_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_constructor_001.phpt
@@ -8,10 +8,10 @@ $myInstance = new stdClass;
$r2 = new ReflectionClass($myInstance);
class TrickClass {
- function __toString() {
- //Return the name of another class
- return "Exception";
- }
+ function __toString() {
+ //Return the name of another class
+ return "Exception";
+ }
}
$myTrickClass = new TrickClass;
$r3 = new ReflectionClass($myTrickClass);
diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
index c463bb72c1..3744fec06c 100644
--- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
@@ -3,64 +3,55 @@ ReflectionClass::__constructor() - bad arguments
--FILE--
<?php
try {
- var_dump(new ReflectionClass());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump(new ReflectionClass());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(null));
+ var_dump(new ReflectionClass(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(true));
+ var_dump(new ReflectionClass(true));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(1));
+ var_dump(new ReflectionClass(1));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(array(1,2,3)));
+ var_dump(new ReflectionClass(array(1,2,3)));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass("stdClass", 1));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump(new ReflectionClass("stdClass", 1));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass("X"));
+ var_dump(new ReflectionClass("X"));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
-Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(0) ""
-}
+ReflectionClass::__construct() expects exactly 1 parameter, 0 given
Class does not exist
Class 1 does not exist
Class 1 does not exist
-Notice: Array to string conversion in %s on line 27
+Warning: Array to string conversion in %s on line %d
Class Array does not exist
-
-Warning: ReflectionClass::__construct() expects exactly 1 parameter, 2 given in %s on line 33
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(0) ""
-}
+ReflectionClass::__construct() expects exactly 1 parameter, 2 given
Class X does not exist
diff --git a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt
index 80d2be2585..2e050af209 100644
--- a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt
@@ -3,8 +3,8 @@ ReflectionClass::__toString() - array constants
--FILE--
<?php
Class A {
- const A = 8;
- const B = ["a", "b"];
+ const A = 8;
+ const B = ["a", "b"];
}
echo new ReflectionClass("A"), "\n";
?>
diff --git a/ext/reflection/tests/ReflectionClass_export_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
index d9183442c4..318e47b355 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
@@ -3,15 +3,15 @@ ReflectionClass::__toString() - various parameters
--FILE--
<?php
Class A {
- public function privf(Exception $a) {}
- public function pubf(A $a,
- $b,
- C $c = null,
- $d = K,
- $e = "15 chars long -",
- $f = null,
- $g = false,
- array $h = null) {}
+ public function privf(Exception $a) {}
+ public function pubf(A $a,
+ $b,
+ C $c = null,
+ $d = K,
+ $e = "15 chars long -",
+ $f = null,
+ $g = false,
+ array $h = null) {}
}
Class C extends A { }
@@ -50,12 +50,12 @@ Class [ <user> class C extends A ] {
- Parameters [8] {
Parameter #0 [ <required> A $a ]
Parameter #1 [ <required> $b ]
- Parameter #2 [ <optional> C or NULL $c = NULL ]
+ Parameter #2 [ <optional> ?C $c = NULL ]
Parameter #3 [ <optional> $d = '16 chars long -...' ]
Parameter #4 [ <optional> $e = '15 chars long -' ]
Parameter #5 [ <optional> $f = NULL ]
Parameter #6 [ <optional> $g = false ]
- Parameter #7 [ <optional> array or NULL $h = NULL ]
+ Parameter #7 [ <optional> ?array $h = NULL ]
}
}
}
diff --git a/ext/reflection/tests/ReflectionClass_export_basic2.phpt b/ext/reflection/tests/ReflectionClass_export_basic2.phpt
index 12cee4e6e3..5ed4ad5d7b 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic2.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic2.phpt
@@ -3,8 +3,10 @@ ReflectionClass::__toString() - ensure inherited private props are hidden.
--FILE--
<?php
Class c {
- private $a;
- static private $b;
+ private $a;
+ static private $b;
+ public ?int $c = 42;
+ public Foo $d;
}
class d extends c {}
@@ -14,20 +16,22 @@ echo new ReflectionClass("d"), "\n";
?>
--EXPECTF--
Class [ <user> class c ] {
- @@ %s 2-5
+ @@ %s 2-7
- Constants [0] {
}
- Static properties [1] {
- Property [ private static $b ]
+ Property [ private static $b = NULL ]
}
- Static methods [0] {
}
- - Properties [1] {
- Property [ <default> private $a ]
+ - Properties [3] {
+ Property [ private $a = NULL ]
+ Property [ public ?int $c = 42 ]
+ Property [ public Foo $d ]
}
- Methods [0] {
@@ -35,7 +39,7 @@ Class [ <user> class c ] {
}
Class [ <user> class d extends c ] {
- @@ %s 7-7
+ @@ %s 9-9
- Constants [0] {
}
@@ -46,7 +50,9 @@ Class [ <user> class d extends c ] {
- Static methods [0] {
}
- - Properties [0] {
+ - Properties [2] {
+ Property [ public ?int $c = 42 ]
+ Property [ public Foo $d ]
}
- Methods [0] {
diff --git a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt
index cbed1252fa..b8906b2070 100644
--- a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt
@@ -3,24 +3,24 @@ ReflectionClass::getConstants()
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array("C", "D", "E", "F", "X");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getConstant('a'));
- var_dump($rc->getConstant('doesntexist'));
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getConstant('a'));
+ var_dump($rc->getConstant('doesnotexist'));
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
index 5260e719a3..ca9bc0ce2d 100644
--- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
@@ -3,35 +3,19 @@ ReflectionClass::getConstant() - bad params
--FILE--
<?php
class C {
- const myConst = 1;
+ const myConst = 1;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->getConstant());
-var_dump($rc->getConstant("myConst", "myConst"));
var_dump($rc->getConstant(null));
var_dump($rc->getConstant(1));
var_dump($rc->getConstant(1.5));
var_dump($rc->getConstant(true));
-var_dump($rc->getConstant(array(1,2,3)));
-var_dump($rc->getConstant(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt
index a9c0cd4225..c4d2c5267f 100644
--- a/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt
@@ -3,23 +3,23 @@ ReflectionClass::getConstants()
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array('C', 'D', 'E', 'F', 'X');
foreach($classes as $class) {
- echo "Constants from class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getConstants());
+ echo "Constants from class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getConstants());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
index 5db9d8f3d3..bbf26e04a5 100644
--- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
@@ -3,81 +3,25 @@ ReflectionClass::getConstructor()
--FILE--
<?php
class NewCtor {
- function __construct() {}
+ function __construct() {}
}
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
-class X {
- function Y() {}
-}
-
-class Y extends X {
-}
-
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
-class B {
- function B() {}
-}
-
-class C extends B {
- function C() {}
-}
-
-class D1 extends C {
- function __construct() {}
-}
-
-class D2 extends C {
-}
-
-$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
- 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
-
+$classes = array('NewCtor', 'ExtendsNewCtor');
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
- $rm = $rc->getConstructor();
- if ($rm != null) {
- echo "Constructor of $class: " . $rm->getName() . "\n";
- } else {
- echo "No constructor for $class\n";
- }
+ $rc = new ReflectionClass($class);
+ $rm = $rc->getConstructor();
+ if ($rm != null) {
+ echo "Constructor of $class: " . $rm->getName() . "\n";
+ } else {
+ echo "No constructor for $class\n";
+ }
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
+--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
-Constructor of D1: __construct
-Constructor of D2: C
-No constructor for X
-No constructor for Y
diff --git a/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt b/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt
index 3778adb403..0adbd34335 100644
--- a/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt
@@ -8,68 +8,68 @@ Steve Seear <stevseea@php.net>
class A {
- static public $statPubC = "stat pubC in A";
- static protected $statProtC = "stat protC in A";
- static private $statPrivC = "stat privC in A";
+ static public $statPubC = "stat pubC in A";
+ static protected $statProtC = "stat protC in A";
+ static private $statPrivC = "stat privC in A";
- static public $statPubA = "stat pubA in A";
- static protected $statProtA = "stat protA in A";
- static private $statPrivA = "stat privA in A";
+ static public $statPubA = "stat pubA in A";
+ static protected $statProtA = "stat protA in A";
+ static private $statPrivA = "stat privA in A";
- public $pubC = "pubC in A";
- protected $protC = "protC in A";
- private $privC = "privC in A";
+ public $pubC = "pubC in A";
+ protected $protC = "protC in A";
+ private $privC = "privC in A";
- public $pubA = "pubA in A";
- protected $protA = "protA in A";
- private $privA = "privA in A";
+ public $pubA = "pubA in A";
+ protected $protA = "protA in A";
+ private $privA = "privA in A";
}
class B extends A {
- static public $statPubC = "stat pubC in B";
- static protected $statProtC = "stat protC in B";
- static private $statPrivC = "stat privC in B";
+ static public $statPubC = "stat pubC in B";
+ static protected $statProtC = "stat protC in B";
+ static private $statPrivC = "stat privC in B";
- static public $statPubB = "stat pubB in B";
- static protected $statProtB = "stat protB in B";
- static private $statPrivB = "stat privB in B";
+ static public $statPubB = "stat pubB in B";
+ static protected $statProtB = "stat protB in B";
+ static private $statPrivB = "stat privB in B";
- public $pubC = "pubC in B";
- protected $protC = "protC in B";
- private $privC = "privC in B";
+ public $pubC = "pubC in B";
+ protected $protC = "protC in B";
+ private $privC = "privC in B";
- public $pubB = "pubB in B";
- protected $protB = "protB in B";
- private $privB = "privB in B";
+ public $pubB = "pubB in B";
+ protected $protB = "protB in B";
+ private $privB = "privB in B";
}
class C extends B {
- static public $statPubC = "stat pubC in C";
- static protected $statProtC = "stat protC in C";
- static private $statPrivC = "stat privC in C";
+ static public $statPubC = "stat pubC in C";
+ static protected $statProtC = "stat protC in C";
+ static private $statPrivC = "stat privC in C";
- public $pubC = "pubC in C";
- protected $protC = "protC in C";
- private $privC = "privC in C";
+ public $pubC = "pubC in C";
+ protected $protC = "protC in C";
+ private $privC = "privC in C";
}
class X {
- static public $statPubC = "stat pubC in X";
- static protected $statProtC = "stat protC in X";
- static private $statPrivC = "stat privC in X";
+ static public $statPubC = "stat pubC in X";
+ static protected $statProtC = "stat protC in X";
+ static private $statPrivC = "stat privC in X";
- public $pubC = "pubC in X";
- protected $protC = "protC in X";
- private $privC = "privC in X";
+ public $pubC = "pubC in X";
+ protected $protC = "protC in X";
+ private $privC = "privC in X";
}
$classes = array('A', 'B', 'C', 'X');
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
- echo "\n\n---- Static properties in $class ----\n";
- print_r($rc->getStaticProperties());
- echo "\n\n---- Default properties in $class ----\n";
- print_r($rc->getDefaultProperties());
+ $rc = new ReflectionClass($class);
+ echo "\n\n---- Static properties in $class ----\n";
+ print_r($rc->getStaticProperties());
+ echo "\n\n---- Default properties in $class ----\n";
+ print_r($rc->getDefaultProperties());
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt b/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt
index 9171a8dd25..28b92abedb 100644
--- a/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt
@@ -10,9 +10,9 @@ opcache.save_comments=1
/**
- My
+ My
Doc
- * Comment
+ * Comment
for A
* */
@@ -48,9 +48,9 @@ final class G extends C implements I {} {}
$classes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'I');
foreach ($classes as $class) {
- echo "\n\n---> Doc comment for class $class:\n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getDocComment());
+ echo "\n\n---> Doc comment for class $class:\n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getDocComment());
}
@@ -60,9 +60,9 @@ foreach ($classes as $class) {
string(%d) "/**
- My
+ My
Doc
- * Comment
+ * Comment
for A
* */"
diff --git a/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt b/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt
index 310b22e695..84e38b0802 100644
--- a/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt
@@ -7,8 +7,8 @@ Rein Velt <rein@velt.org>
#testFest Roosendaal 2008-05-10
--FILE--
<?php
- $rc=new reflectionClass('domDocument');
- var_dump( $rc->getExtensionName()) ;
+ $rc=new reflectionClass('domDocument');
+ var_dump( $rc->getExtensionName()) ;
?>
--EXPECT--
string(3) "dom"
diff --git a/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt b/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt
index 4f78343081..4b4ed125a4 100644
--- a/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt
@@ -6,13 +6,13 @@ Rein Velt <rein@velt.org>
--FILE--
<?php
- class myClass
- {
- public $varX;
- public $varY;
- }
- $rc=new reflectionClass('myClass');
- var_dump( $rc->getExtensionName()) ;
+ class myClass
+ {
+ public $varX;
+ public $varY;
+ }
+ $rc=new reflectionClass('myClass');
+ var_dump( $rc->getExtensionName()) ;
?>
--EXPECT--
bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt b/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt
index dbe157acd6..8cd1caad74 100644
--- a/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt
@@ -7,8 +7,8 @@ Rein Velt <rein@velt.org>
#testFest Roosendaal 2008-05-10
--FILE--
<?php
- $rc=new reflectionClass('domDocument');
- var_dump($rc->getExtension()) ;
+ $rc=new reflectionClass('domDocument');
+ var_dump($rc->getExtension()) ;
?>
--EXPECTF--
object(ReflectionExtension)#%d (1) {
diff --git a/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt b/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt
index f3697792db..b8a881f9b3 100644
--- a/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt
@@ -6,13 +6,13 @@ Rein Velt <rein@velt.org>
--FILE--
<?php
- class myClass
- {
- public $varX;
- public $varY;
- }
- $rc=new reflectionClass('myClass');
- var_dump( $rc->getExtension()) ;
+ class myClass
+ {
+ public $varX;
+ public $varY;
+ }
+ $rc=new reflectionClass('myClass');
+ var_dump( $rc->getExtension()) ;
?>
--EXPECT--
NULL
diff --git a/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt b/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt
index 6f7561c462..feaa703c98 100644
--- a/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt
@@ -29,16 +29,16 @@ class C6 implements I1, I2, I3, I4, I5, I6, I7 {}
$classes = array( 'A0', 'A1', 'B0', 'B1',
- 'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7',
- 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6' );
+ 'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7',
+ 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6' );
foreach ($classes as $class) {
- echo "---( Interfaces implemented by $class )---\n ";
- $rc = new ReflectionClass($class);
- $interfaces = $rc->getInterfaces();
- // Sort interfaces so that tests do not fail because of wrong order.
- ksort($interfaces);
- print_r($interfaces);
+ echo "---( Interfaces implemented by $class )---\n ";
+ $rc = new ReflectionClass($class);
+ $interfaces = $rc->getInterfaces();
+ // Sort interfaces so that tests do not fail because of wrong order.
+ ksort($interfaces);
+ print_r($interfaces);
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt
index 59887991ec..c8a2ed14ed 100644
--- a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt
@@ -6,43 +6,43 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public function f() {}
- static public function s() {}
+ public function f() {}
+ static public function s() {}
}
class subpubf extends pubf {
}
class protf {
- protected function f() {}
- static protected function s() {}
+ protected function f() {}
+ static protected function s() {}
}
class subprotf extends protf {
}
class privf {
- private function f() {}
- static private function s() {}
+ private function f() {}
+ static private function s() {}
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- echo " --> Check for f(): ";
- var_dump($rc->getMethod("f"));
- echo " --> Check for s(): ";
- var_dump($rc->getMethod("s"));
- echo " --> Check for F(): ";
- var_dump($rc->getMethod("F"));
- echo " --> Check for doesntExist(): ";
- try {
- var_dump($rc->getMethod("doesntExist"));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ echo " --> Check for f(): ";
+ var_dump($rc->getMethod("f"));
+ echo " --> Check for s(): ";
+ var_dump($rc->getMethod("s"));
+ echo " --> Check for F(): ";
+ var_dump($rc->getMethod("F"));
+ echo " --> Check for doesNotExist(): ";
+ try {
+ var_dump($rc->getMethod("doesNotExist"));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--EXPECTF--
@@ -65,7 +65,7 @@ Reflecting on class pubf:
["class"]=>
string(4) "pubf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class subpubf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -85,7 +85,7 @@ Reflecting on class subpubf:
["class"]=>
string(4) "pubf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class protf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -105,7 +105,7 @@ Reflecting on class protf:
["class"]=>
string(5) "protf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class subprotf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -125,7 +125,7 @@ Reflecting on class subprotf:
["class"]=>
string(5) "protf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class privf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -145,7 +145,7 @@ Reflecting on class privf:
["class"]=>
string(5) "privf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class subprivf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -165,4 +165,4 @@ Reflecting on class subprivf:
["class"]=>
string(5) "privf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
index 1eb084214b..e48d43587e 100644
--- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
@@ -6,69 +6,61 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- function f() {}
+ function f() {}
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
- var_dump($rc->getMethod());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod("f", "f"));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod("f", "f"));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(null));
+ var_dump($rc->getMethod(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(1));
+ var_dump($rc->getMethod(1));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(1.5));
+ var_dump($rc->getMethod(1.5));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(true));
+ var_dump($rc->getMethod(true));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(array(1,2,3)));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod(array(1,2,3)));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(new C));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod(new C));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 0 given in %s on line 9
-NULL
-
-Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 2 given in %s on line 14
-NULL
+ReflectionClass::getMethod() expects exactly 1 parameter, 0 given
+ReflectionClass::getMethod() expects exactly 1 parameter, 2 given
Method does not exist
Method 1 does not exist
Method 1.5 does not exist
Method 1 does not exist
-
-Warning: ReflectionClass::getMethod() expects parameter 1 to be string, array given in %s on line 39
-NULL
-
-Warning: ReflectionClass::getMethod() expects parameter 1 to be string, object given in %s on line 44
-NULL
+ReflectionClass::getMethod(): Argument #1 ($name) must be of type string, array given
+ReflectionClass::getMethod(): Argument #1 ($name) must be of type string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getMethods_001.phpt b/ext/reflection/tests/ReflectionClass_getMethods_001.phpt
index dca9adb56d..4e008e8710 100644
--- a/ext/reflection/tests/ReflectionClass_getMethods_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethods_001.phpt
@@ -6,32 +6,32 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public function f() {}
- static public function s() {}
+ public function f() {}
+ static public function s() {}
}
class subpubf extends pubf {
}
class protf {
- protected function f() {}
- static protected function s() {}
+ protected function f() {}
+ static protected function s() {}
}
class subprotf extends protf {
}
class privf {
- private function f() {}
- static private function s() {}
+ private function f() {}
+ static private function s() {}
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getMethods());
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getMethods());
}
?>
@@ -122,19 +122,5 @@ array(2) {
}
}
Reflecting on class subprivf:
-array(2) {
- [0]=>
- object(ReflectionMethod)#%d (2) {
- ["name"]=>
- string(1) "f"
- ["class"]=>
- string(5) "privf"
- }
- [1]=>
- object(ReflectionMethod)#%d (2) {
- ["name"]=>
- string(1) "s"
- ["class"]=>
- string(5) "privf"
- }
+array(0) {
}
diff --git a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
index b08fcaa4d4..d40e0b9122 100644
--- a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
@@ -6,14 +6,14 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public function pubf1() {}
- public function pubf2() {}
- private function privf1() {}
- private function privf2() {}
- static public function pubsf1() {}
- static public function pubsf2() {}
- static private function privsf1() {}
- static private function privsf2() {}
+ public function pubf1() {}
+ public function pubf2() {}
+ private function privf1() {}
+ private function privf2() {}
+ static public function pubsf1() {}
+ static public function pubsf2() {}
+ static private function privsf1() {}
+ static private function privsf2() {}
}
$rc = new ReflectionClass("C");
diff --git a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt
index 91a0a18f1a..f792031a01 100644
--- a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt
@@ -11,34 +11,34 @@ final class c {}
class x
{
- function __construct() {}
- function __destruct() {}
- private function a() {}
- private static function b() {}
- protected function c() {}
- protected static function d() {}
- public function e() {}
- public static function f() {}
- final function g() {}
- function h() {}
+ function __construct() {}
+ function __destruct() {}
+ private function a() {}
+ private static function b() {}
+ protected function c() {}
+ protected static function d() {}
+ public function e() {}
+ public static function f() {}
+ final function g() {}
+ function h() {}
}
abstract class y
{
- abstract function a();
- abstract protected function b();
+ abstract function a();
+ abstract protected function b();
}
function dump_modifierNames($class) {
- $obj = new ReflectionClass($class);
- var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers()));
+ $obj = new ReflectionClass($class);
+ var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers()));
}
function dump_methodModifierNames($class) {
- $obj = new ReflectionClass($class);
- foreach($obj->getMethods() as $method) {
- var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers()));
- }
+ $obj = new ReflectionClass($class);
+ foreach($obj->getMethods() as $method) {
+ var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers()));
+ }
}
dump_modifierNames('a');
@@ -49,7 +49,6 @@ dump_methodModifierNames('x');
dump_methodModifierNames('y');
?>
-==DONE==
--EXPECT--
string(1) "a"
array(0) {
@@ -136,4 +135,3 @@ array(2) {
[1]=>
string(9) "protected"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
index ffe8876133..447f8d2edc 100644
--- a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
@@ -14,8 +14,8 @@ interface f extends d {}
class g extends b {}
function dump_modifiers($class) {
- $obj = new ReflectionClass($class);
- var_dump($obj->getModifiers());
+ $obj = new ReflectionClass($class);
+ var_dump($obj->getModifiers());
}
dump_modifiers('a');
diff --git a/ext/reflection/tests/ReflectionClass_getName_basic.phpt b/ext/reflection/tests/ReflectionClass_getName_basic.phpt
index 37cec4bc81..f230165f0d 100644
--- a/ext/reflection/tests/ReflectionClass_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getName_basic.phpt
@@ -3,10 +3,10 @@ ReflectionClass::getName()
--FILE--
<?php
class TrickClass {
- function __toString() {
- //Return the name of another class
- return "Exception";
- }
+ function __toString() {
+ //Return the name of another class
+ return "Exception";
+ }
}
$r1 = new ReflectionClass("stdClass");
diff --git a/ext/reflection/tests/ReflectionClass_getParentClass.phpt b/ext/reflection/tests/ReflectionClass_getParentClass.phpt
index 382948d3d3..ef64de5ecb 100644
--- a/ext/reflection/tests/ReflectionClass_getParentClass.phpt
+++ b/ext/reflection/tests/ReflectionClass_getParentClass.phpt
@@ -10,11 +10,14 @@ class Foo {}
class Bar extends Foo {}
-$rc1 = new ReflectionClass("Bar");
-var_dump($rc1->getParentClass());
+$rc = new ReflectionClass("Bar");
+$parent = $rc->getParentClass();
+$grandParent = $parent->getParentClass();
+var_dump($parent, $grandParent);
?>
--EXPECTF--
object(ReflectionClass)#%d (1) {
["name"]=>
string(3) "Foo"
}
+bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt b/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt
deleted file mode 100644
index be50dbb730..0000000000
--- a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-ReflectionClass::getParentClass()
---CREDITS--
-Robin Fernandes <robinf@php.net>
-Steve Seear <stevseea@php.net>
---FILE--
-<?php
-class A {}
-class B extends A {}
-
-$rc = new ReflectionClass('B');
-$parent = $rc->getParentClass();
-$grandParent = $parent->getParentClass();
-var_dump($parent, $grandParent);
-
-echo "\nTest bad params:\n";
-var_dump($rc->getParentClass(null));
-var_dump($rc->getParentClass('x'));
-var_dump($rc->getParentClass('x', 123));
-
-?>
---EXPECTF--
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(1) "A"
-}
-bool(false)
-
-Test bad params:
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 2 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_getProperties_001.phpt b/ext/reflection/tests/ReflectionClass_getProperties_001.phpt
index 3554af3890..0607822a20 100644
--- a/ext/reflection/tests/ReflectionClass_getProperties_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperties_001.phpt
@@ -6,32 +6,32 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public $a;
- static public $s;
+ public $a;
+ static public $s;
}
class subpubf extends pubf {
}
class protf {
- protected $a;
- static protected $s;
+ protected $a;
+ static protected $s;
}
class subprotf extends protf {
}
class privf {
- private $a;
- static private $s;
+ private $a;
+ static private $s;
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getProperties());
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getProperties());
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
index fe3792a30f..63d5d476b4 100644
--- a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
@@ -6,14 +6,14 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public $pub1;
- public $pub2;
- private $priv1;
- private $priv2;
- static public $pubs;
- static public $pubs2;
- static private $privs1;
- static private $privs2;
+ public $pub1;
+ public $pub2;
+ private $priv1;
+ private $priv2;
+ static public $pubs;
+ static public $pubs2;
+ static private $privs1;
+ static private $privs2;
}
$rc = new ReflectionClass("C");
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt
index 830608e0ca..2d5494b264 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt
@@ -6,55 +6,55 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public $a;
- static public $s;
+ public $a;
+ static public $s;
}
class subpubf extends pubf {
}
class protf {
- protected $a;
- static protected $s;
+ protected $a;
+ static protected $s;
}
class subprotf extends protf {
}
class privf {
- private $a;
- static protected $s;
+ private $a;
+ static protected $s;
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- try {
- echo " --> Check for s: ";
- var_dump($rc->getProperty("s"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo " --> Check for a: ";
- var_dump($rc->getProperty("a"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo " --> Check for A: ";
- var_dump($rc->getProperty("A"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo " --> Check for doesntExist: ";
- var_dump($rc->getProperty("doesntExist"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ try {
+ echo " --> Check for s: ";
+ var_dump($rc->getProperty("s"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ echo " --> Check for a: ";
+ var_dump($rc->getProperty("a"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ echo " --> Check for A: ";
+ var_dump($rc->getProperty("A"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ echo " --> Check for doesNotExist: ";
+ var_dump($rc->getProperty("doesNotExist"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
@@ -73,7 +73,7 @@ Reflecting on class pubf:
string(4) "pubf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class subpubf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -88,7 +88,7 @@ Reflecting on class subpubf:
string(4) "pubf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class protf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -103,7 +103,7 @@ Reflecting on class protf:
string(5) "protf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class subprotf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -118,7 +118,7 @@ Reflecting on class subprotf:
string(5) "protf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class privf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -133,7 +133,7 @@ Reflecting on class privf:
string(5) "privf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class subprivf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -143,4 +143,4 @@ Reflecting on class subprivf:
}
--> Check for a: Property a does not exist
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
index 68522e097a..86060c8acf 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
@@ -6,67 +6,59 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public $a;
+ public $a;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
- var_dump($rc->getProperty());
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty("a", "a"));
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty("a", "a"));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(null));
+ var_dump($rc->getProperty(null));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(1));
+ var_dump($rc->getProperty(1));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(1.5));
+ var_dump($rc->getProperty(1.5));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(true));
+ var_dump($rc->getProperty(true));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(array(1,2,3)));
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty(array(1,2,3)));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(new C));
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty(new C));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 0 given in %s on line 9
-NULL
-
-Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 2 given in %s on line 14
-NULL
+ReflectionClass::getProperty() expects exactly 1 parameter, 0 given
+ReflectionClass::getProperty() expects exactly 1 parameter, 2 given
Property does not exist
Property 1 does not exist
Property 1.5 does not exist
Property 1 does not exist
-
-Warning: ReflectionClass::getProperty() expects parameter 1 to be string, array given in %s on line 39
-NULL
-
-Warning: ReflectionClass::getProperty() expects parameter 1 to be string, object given in %s on line 44
-NULL
+ReflectionClass::getProperty(): Argument #1 ($name) must be of type string, array given
+ReflectionClass::getProperty(): Argument #1 ($name) must be of type string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
index 61d63362dc..34ade2fc5e 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
@@ -6,56 +6,56 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- static public $pubC = "pubC in A";
- static protected $protC = "protC in A";
- static private $privC = "privC in A";
+ static public $pubC = "pubC in A";
+ static protected $protC = "protC in A";
+ static private $privC = "privC in A";
- static public $pubA = "pubA in A";
- static protected $protA = "protA in A";
- static private $privA = "privA in A";
+ static public $pubA = "pubA in A";
+ static protected $protA = "protA in A";
+ static private $privA = "privA in A";
}
class B extends A {
- static public $pubC = "pubC in B";
- static protected $protC = "protC in B";
- static private $privC = "privC in B";
+ static public $pubC = "pubC in B";
+ static protected $protC = "protC in B";
+ static private $privC = "privC in B";
- static public $pubB = "pubB in B";
- static protected $protB = "protB in B";
- static private $privB = "privB in B";
+ static public $pubB = "pubB in B";
+ static protected $protB = "protB in B";
+ static private $privB = "privB in B";
}
class C extends B {
- static public $pubC = "pubC in C";
- static protected $protC = "protC in C";
- static private $privC = "privC in C";
+ static public $pubC = "pubC in C";
+ static protected $protC = "protC in C";
+ static private $privC = "privC in C";
}
class X {
- static public $pubC = "pubC in X";
- static protected $protC = "protC in X";
- static private $privC = "privC in X";
+ static public $pubC = "pubC in X";
+ static protected $protC = "protC in X";
+ static private $privC = "privC in X";
}
$myC = new C;
$rc = new ReflectionClass("C");
function showInfo($name) {
- global $rc, $myC;
- echo "--- (Reflecting on $name) ---\n";
- try {
- $rp = $rc->getProperty($name);
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
- try {
- var_dump($rp);
- var_dump($rp->getValue($myC));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
+ global $rc, $myC;
+ echo "--- (Reflecting on $name) ---\n";
+ try {
+ $rp = $rc->getProperty($name);
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
+ try {
+ var_dump($rp);
+ var_dump($rp->getValue($myC));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
}
@@ -70,7 +70,7 @@ showInfo("privB");
showInfo("pubC");
showInfo("protC");
showInfo("privC");
-showInfo("doesntExist");
+showInfo("doesNotExist");
showInfo("A::pubC");
showInfo("A::protC");
@@ -89,9 +89,9 @@ showInfo("C::privC");
showInfo("X::pubC");
showInfo("X::protC");
showInfo("X::privC");
-showInfo("X::doesntExist");
+showInfo("X::doesNotExist");
-showInfo("doesntexist::doesntExist");
+showInfo("doesNotexist::doesNotExist");
?>
--EXPECTF--
@@ -155,8 +155,8 @@ object(ReflectionProperty)#%d (2) {
string(1) "C"
}
Cannot access non-public member C::$privC
---- (Reflecting on doesntExist) ---
-Property doesntExist does not exist
+--- (Reflecting on doesNotExist) ---
+Property doesNotExist does not exist
--- (Reflecting on A::pubC) ---
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -245,7 +245,7 @@ Fully qualified property name X::pubC does not specify a base class of C
Fully qualified property name X::protC does not specify a base class of C
--- (Reflecting on X::privC) ---
Fully qualified property name X::privC does not specify a base class of C
---- (Reflecting on X::doesntExist) ---
-Fully qualified property name X::doesntExist does not specify a base class of C
---- (Reflecting on doesntexist::doesntExist) ---
-Class doesntexist does not exist
+--- (Reflecting on X::doesNotExist) ---
+Fully qualified property name X::doesNotExist does not specify a base class of C
+--- (Reflecting on doesNotexist::doesNotExist) ---
+Class doesnotexist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
index ce2aa57871..b5396aae40 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
@@ -6,56 +6,56 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- public $pubC = "pubC in A";
- protected $protC = "protC in A";
- private $privC = "privC in A";
+ public $pubC = "pubC in A";
+ protected $protC = "protC in A";
+ private $privC = "privC in A";
- public $pubA = "pubA in A";
- protected $protA = "protA in A";
- private $privA = "privA in A";
+ public $pubA = "pubA in A";
+ protected $protA = "protA in A";
+ private $privA = "privA in A";
}
class B extends A {
- public $pubC = "pubC in B";
- protected $protC = "protC in B";
- private $privC = "privC in B";
+ public $pubC = "pubC in B";
+ protected $protC = "protC in B";
+ private $privC = "privC in B";
- public $pubB = "pubB in B";
- protected $protB = "protB in B";
- private $privB = "privB in B";
+ public $pubB = "pubB in B";
+ protected $protB = "protB in B";
+ private $privB = "privB in B";
}
class C extends B {
- public $pubC = "pubC in C";
- protected $protC = "protC in C";
- private $privC = "privC in C";
+ public $pubC = "pubC in C";
+ protected $protC = "protC in C";
+ private $privC = "privC in C";
}
class X {
- public $pubC = "pubC in X";
- protected $protC = "protC in X";
- private $privC = "privC in X";
+ public $pubC = "pubC in X";
+ protected $protC = "protC in X";
+ private $privC = "privC in X";
}
$myC = new C;
$rc = new ReflectionClass("C");
function showInfo($name) {
- global $rc, $myC;
- echo "--- (Reflecting on $name) ---\n";
- try {
- $rp = $rc->getProperty($name);
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
- try {
- var_dump($rp);
- var_dump($rp->getValue($myC));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
+ global $rc, $myC;
+ echo "--- (Reflecting on $name) ---\n";
+ try {
+ $rp = $rc->getProperty($name);
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
+ try {
+ var_dump($rp);
+ var_dump($rp->getValue($myC));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
}
@@ -70,7 +70,7 @@ showInfo("privB");
showInfo("pubC");
showInfo("protC");
showInfo("privC");
-showInfo("doesntExist");
+showInfo("doesNotExist");
showInfo("A::pubC");
showInfo("A::protC");
@@ -89,9 +89,9 @@ showInfo("C::privC");
showInfo("X::pubC");
showInfo("X::protC");
showInfo("X::privC");
-showInfo("X::doesntExist");
+showInfo("X::doesNotExist");
-showInfo("doesntexist::doesntExist");
+showInfo("doesNotexist::doesNotExist");
?>
--EXPECTF--
@@ -155,8 +155,8 @@ object(ReflectionProperty)#%d (2) {
string(1) "C"
}
Cannot access non-public member C::$privC
---- (Reflecting on doesntExist) ---
-Property doesntExist does not exist
+--- (Reflecting on doesNotExist) ---
+Property doesNotExist does not exist
--- (Reflecting on A::pubC) ---
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -245,7 +245,7 @@ Fully qualified property name X::pubC does not specify a base class of C
Fully qualified property name X::protC does not specify a base class of C
--- (Reflecting on X::privC) ---
Fully qualified property name X::privC does not specify a base class of C
---- (Reflecting on X::doesntExist) ---
-Fully qualified property name X::doesntExist does not specify a base class of C
---- (Reflecting on doesntexist::doesntExist) ---
-Class doesntexist does not exist
+--- (Reflecting on X::doesNotExist) ---
+Fully qualified property name X::doesNotExist does not specify a base class of C
+--- (Reflecting on doesNotexist::doesNotExist) ---
+Class doesnotexist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
index 365ec89ff1..b11d2ec0d7 100644
--- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
@@ -6,15 +6,15 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- static private $privateOverridden = "original private";
- static protected $protectedOverridden = "original protected";
- static public $publicOverridden = "original public";
+ static private $privateOverridden = "original private";
+ static protected $protectedOverridden = "original protected";
+ static public $publicOverridden = "original public";
}
class B extends A {
- static private $privateOverridden = "changed private";
- static protected $protectedOverridden = "changed protected";
- static public $publicOverridden = "changed public";
+ static private $privateOverridden = "changed private";
+ static protected $protectedOverridden = "changed protected";
+ static public $publicOverridden = "changed public";
}
echo "Retrieving static values from A:\n";
@@ -34,17 +34,17 @@ var_dump($rcB->getStaticPropertyValue("publicOverridden"));
echo "\nRetrieving non-existent values from A with no default value:\n";
try {
- var_dump($rcA->getStaticPropertyValue("protectedOverridden"));
- echo "you should not see this";
+ var_dump($rcA->getStaticPropertyValue("protectedOverridden"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcA->getStaticPropertyValue("privateOverridden"));
- echo "you should not see this";
+ var_dump($rcA->getStaticPropertyValue("privateOverridden"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
index 52fa378eb6..e034e08215 100644
--- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
@@ -6,46 +6,41 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public static $x;
+ public static $x;
}
$rc = new ReflectionClass('C');
try {
- var_dump($rc->getStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getStaticPropertyValue("x", "default value", 'blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getStaticPropertyValue());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue(null));
+ var_dump($rc->getStaticPropertyValue(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue(1.5, 'def'));
+ var_dump($rc->getStaticPropertyValue(1.5, 'def'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue(array(1,2,3)));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getStaticPropertyValue(array(1,2,3)));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
-Warning: ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given in %s on line 13
-NULL
+--EXPECT--
+ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given
+ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given
Class C does not have a property named
string(3) "def"
-
-Warning: ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 28
-NULL
+ReflectionClass::getStaticPropertyValue(): Argument #1 ($name) must be of type string, array given
diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt
index 84e334ba19..5783b2b506 100644
--- a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt
@@ -6,7 +6,7 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- const myConst = 1;
+ const myConst = 1;
}
class D extends C {
@@ -19,14 +19,14 @@ var_dump($rc->hasConstant("myConst"));
echo "Check existing constant, different case: ";
var_dump($rc->hasConstant("MyCoNsT"));
echo "Check absent constant: ";
-var_dump($rc->hasConstant("doesntExist"));
+var_dump($rc->hasConstant("doesNotExist"));
$rd = new ReflectionClass("D");
echo "Check inherited constant: ";
var_dump($rd->hasConstant("myConst"));
echo "Check absent constant: ";
-var_dump($rd->hasConstant("doesntExist"));
+var_dump($rd->hasConstant("doesNotExist"));
?>
--EXPECT--
Check existing constant: bool(true)
diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
index 14c847401d..5dcc7df173 100644
--- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
@@ -6,35 +6,19 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- const myConst = 1;
+ const myConst = 1;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasConstant());
-var_dump($rc->hasConstant("myConst", "myConst"));
var_dump($rc->hasConstant(null));
var_dump($rc->hasConstant(1));
var_dump($rc->hasConstant(1.5));
var_dump($rc->hasConstant(true));
-var_dump($rc->hasConstant(array(1,2,3)));
-var_dump($rc->hasConstant(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt
index dec76febe1..d987897a6e 100644
--- a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt
@@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public function f() {}
- static public function s() {}
+ public function f() {}
+ static public function s() {}
}
class subpubf extends pubf {
}
class protf {
- protected function f() {}
- static protected function s() {}
+ protected function f() {}
+ static protected function s() {}
}
class subprotf extends protf {
}
class privf {
- private function f() {}
- static private function s() {}
+ private function f() {}
+ static private function s() {}
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- echo " --> Check for f(): ";
- var_dump($rc->hasMethod("f"));
- echo " --> Check for s(): ";
- var_dump($rc->hasMethod("s"));
- echo " --> Check for F(): ";
- var_dump($rc->hasMethod("F"));
- echo " --> Check for doesntExist(): ";
- var_dump($rc->hasMethod("doesntExist"));
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ echo " --> Check for f(): ";
+ var_dump($rc->hasMethod("f"));
+ echo " --> Check for s(): ";
+ var_dump($rc->hasMethod("s"));
+ echo " --> Check for F(): ";
+ var_dump($rc->hasMethod("F"));
+ echo " --> Check for doesNotExist(): ";
+ var_dump($rc->hasMethod("doesNotExist"));
}
?>
--EXPECT--
@@ -46,30 +46,30 @@ Reflecting on class pubf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class subpubf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class protf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class subprotf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class privf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class subprivf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
index 63fe8791fc..2bbc84551e 100644
--- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
@@ -6,35 +6,19 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- function f() {}
+ function f() {}
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasMethod());
-var_dump($rc->hasMethod("f", "f"));
var_dump($rc->hasMethod(null));
var_dump($rc->hasMethod(1));
var_dump($rc->hasMethod(1.5));
var_dump($rc->hasMethod(true));
-var_dump($rc->hasMethod(array(1,2,3)));
-var_dump($rc->hasMethod(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt
index a6c3753a78..12040658ba 100644
--- a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt
@@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public $a;
- static public $s;
+ public $a;
+ static public $s;
}
class subpubf extends pubf {
}
class protf {
- protected $a;
- static protected $s;
+ protected $a;
+ static protected $s;
}
class subprotf extends protf {
}
class privf {
- private $a;
- static protected $s;
+ private $a;
+ static protected $s;
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- echo " --> Check for s: ";
- var_dump($rc->hasProperty("s"));
- echo " --> Check for a: ";
- var_dump($rc->hasProperty("a"));
- echo " --> Check for A: ";
- var_dump($rc->hasProperty("A"));
- echo " --> Check for doesntExist: ";
- var_dump($rc->hasProperty("doesntExist"));
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ echo " --> Check for s: ";
+ var_dump($rc->hasProperty("s"));
+ echo " --> Check for a: ";
+ var_dump($rc->hasProperty("a"));
+ echo " --> Check for A: ";
+ var_dump($rc->hasProperty("A"));
+ echo " --> Check for doesNotExist: ";
+ var_dump($rc->hasProperty("doesNotExist"));
}
?>
--EXPECT--
@@ -46,29 +46,29 @@ Reflecting on class pubf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class subpubf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class protf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class subprotf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class privf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class subprivf:
--> Check for s: bool(true)
--> Check for a: bool(false)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
index 753890394f..a135939052 100644
--- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
@@ -6,35 +6,19 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public $a;
+ public $a;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasProperty());
-var_dump($rc->hasProperty("a", "a"));
var_dump($rc->hasProperty(null));
var_dump($rc->hasProperty(1));
var_dump($rc->hasProperty(1.5));
var_dump($rc->hasProperty(true));
-var_dump($rc->hasProperty(array(1,2,3)));
-var_dump($rc->hasProperty(new C));
?>
--EXPECTF--
Check invalid params:
-
-Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
index d1cbc8ae47..d912b568e8 100644
--- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
@@ -15,57 +15,57 @@ class C implements I2 {}
$classNames = array('A', 'B', 'C', 'I1', 'I2');
foreach ($classNames as $className) {
- $rcs[$className] = new ReflectionClass($className);
+ $rcs[$className] = new ReflectionClass($className);
}
foreach ($rcs as $childName => $child) {
- foreach ($rcs as $parentName => $parent) {
- echo "Does " . $childName . " implement " . $parentName . "? \n";
- echo " - Using object argument: ";
- try {
- var_dump($child->implementsInterface($parent));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- echo " - Using string argument: ";
- try {
- var_dump($child->implementsInterface($parentName));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- }
+ foreach ($rcs as $parentName => $parent) {
+ echo "Does " . $childName . " implement " . $parentName . "? \n";
+ echo " - Using object argument: ";
+ try {
+ var_dump($child->implementsInterface($parent));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ echo " - Using string argument: ";
+ try {
+ var_dump($child->implementsInterface($parentName));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ }
}
echo "\n\nTest bad arguments:\n";
try {
- var_dump($rcs['A']->implementsInterface());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rcs['A']->implementsInterface());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface('C', 'C'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rcs['A']->implementsInterface('C', 'C'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface(null));
+ var_dump($rcs['A']->implementsInterface(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface('ThisClassDoesNotExist'));
+ var_dump($rcs['A']->implementsInterface('ThisClassDoesNotExist'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface(2));
+ var_dump($rcs['A']->implementsInterface(2));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Does A implement A?
- Using object argument: A is not an interface
- Using string argument: A is not an interface
@@ -144,12 +144,8 @@ Does I2 implement I2?
Test bad arguments:
-
-Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given in %s on line 37
-NULL
-
-Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given in %s on line 42
-NULL
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given
+ReflectionClass::implementsInterface(): Argument #1 ($interface) must be of type ReflectionClass|string, null given
Interface ThisClassDoesNotExist does not exist
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::implementsInterface(): Argument #1 ($interface) must be of type ReflectionClass|string, int given
diff --git a/ext/reflection/tests/ReflectionClass_isArray.phpt b/ext/reflection/tests/ReflectionClass_isArray.phpt
index 3eec0dac54..7c6093a55c 100644
--- a/ext/reflection/tests/ReflectionClass_isArray.phpt
+++ b/ext/reflection/tests/ReflectionClass_isArray.phpt
@@ -4,7 +4,8 @@ public bool ReflectionParameter::isArray ( void );
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
--FILE--
<?php
-function testReflectionIsArray($a = null, $b = 0, array $c, $d=true, array $e, $f=1.5, $g="", array $h, $i="#F989898") {}
+
+function testReflectionIsArray(array $a, ?array $b, iterable $c, array|string $d) {}
$reflection = new ReflectionFunction('testReflectionIsArray');
@@ -13,12 +14,7 @@ foreach ($reflection->getParameters() as $parameter) {
}
?>
--EXPECT--
-bool(false)
-bool(false)
bool(true)
-bool(false)
bool(true)
bool(false)
bool(false)
-bool(true)
-bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt b/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt
index 361708a315..caf55fa648 100644
--- a/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt
@@ -17,8 +17,8 @@ var_dump($obj->isCloneable());
$h = clone $foo;
class bar {
- private function __clone() {
- }
+ private function __clone() {
+ }
}
$bar = new bar;
print "User class - private __clone\n";
diff --git a/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt b/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt
index a108718894..e34176fe51 100644
--- a/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt
@@ -13,17 +13,17 @@ class X {}
$classes = array("A", "B", "C", "I", "X");
$instances = array( "myA" => new A,
- "myB" => new B,
- "myC" => new C,
- "myX" => new X );
+ "myB" => new B,
+ "myC" => new C,
+ "myX" => new X );
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
+ $rc = new ReflectionClass($class);
- foreach ($instances as $name => $instance) {
- echo "is $name a $class? ";
- var_dump($rc->isInstance($instance));
- }
+ foreach ($instances as $name => $instance) {
+ echo "is $name a $class? ";
+ var_dump($rc->isInstance($instance));
+ }
}
diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt
index ef179721dc..3bc79b3e79 100644
--- a/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt
@@ -6,28 +6,28 @@ class C {
}
interface iface {
- function f1();
+ function f1();
}
class ifaceImpl implements iface {
- function f1() {}
+ function f1() {}
}
abstract class abstractClass {
- function f1() {}
- abstract function f2();
+ function f1() {}
+ abstract function f2();
}
class D extends abstractClass {
- function f2() {}
+ function f2() {}
}
$classes = array("C", "iface", "ifaceImpl", "abstractClass", "D");
foreach($classes as $class ) {
- $reflectionClass = new ReflectionClass($class);
- echo "Is $class instantiable? ";
- var_dump($reflectionClass->IsInstantiable());
+ $reflectionClass = new ReflectionClass($class);
+ echo "Is $class instantiable? ";
+ var_dump($reflectionClass->IsInstantiable());
}
diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
index 1378edd3d2..cdfaf911e4 100644
--- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
@@ -6,50 +6,27 @@ class noCtor {
}
class publicCtorNew {
- public function __construct() {}
+ public function __construct() {}
}
class protectedCtorNew {
- protected function __construct() {}
+ protected function __construct() {}
}
class privateCtorNew {
- private function __construct() {}
+ private function __construct() {}
}
-class publicCtorOld {
- public function publicCtorOld() {}
-}
-
-class protectedCtorOld {
- protected function protectedCtorOld() {}
-}
-
-class privateCtorOld {
- private function privateCtorOld() {}
-}
-
-
-$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew",
- "publicCtorOld", "protectedCtorOld", "privateCtorOld");
-
-foreach($classes as $class ) {
- $reflectionClass = new ReflectionClass($class);
- echo "Is $class instantiable? ";
- var_dump($reflectionClass->IsInstantiable());
+$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew");
+foreach ($classes as $class) {
+ $reflectionClass = new ReflectionClass($class);
+ echo "Is $class instantiable? ";
+ var_dump($reflectionClass->IsInstantiable());
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
+--EXPECT--
Is noCtor instantiable? bool(true)
Is publicCtorNew instantiable? bool(true)
Is protectedCtorNew instantiable? bool(false)
Is privateCtorNew instantiable? bool(false)
-Is publicCtorOld instantiable? bool(true)
-Is protectedCtorOld instantiable? bool(false)
-Is privateCtorOld instantiable? bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt b/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt
index 9c656a38b6..48f0c963ea 100644
--- a/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionClass("Exception");
$r5 = new ReflectionClass("C");
var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(),
- $r4->isInternal(), $r5->isInternal());
+ $r4->isInternal(), $r5->isInternal());
?>
--EXPECT--
bool(true)
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
index 10a86d9136..ca3e4a8e8f 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
@@ -10,14 +10,14 @@ Interface ExtendsIterator extends Iterator {
Interface ExtendsIteratorAggregate extends IteratorAggregate {
}
Class IteratorImpl implements Iterator {
- public function next() {}
- public function key() {}
- public function rewind() {}
- public function current() {}
- public function valid() {}
+ public function next() {}
+ public function key() {}
+ public function rewind() {}
+ public function current() {}
+ public function valid() {}
}
Class IterarorAggregateImpl implements IteratorAggregate {
- public function getIterator() {}
+ public function getIterator() {}
}
Class ExtendsIteratorImpl extends IteratorImpl {
}
@@ -27,24 +27,14 @@ Class A {
}
$classes = array('Traversable', 'Iterator', 'IteratorAggregate', 'ExtendsIterator', 'ExtendsIteratorAggregate',
- 'IteratorImpl', 'IterarorAggregateImpl', 'ExtendsIteratorImpl', 'ExtendsIteratorAggregateImpl', 'A');
+ 'IteratorImpl', 'IterarorAggregateImpl', 'ExtendsIteratorImpl', 'ExtendsIteratorAggregateImpl', 'A');
foreach($classes as $class) {
- $rc = new ReflectionClass($class);
- echo "Is $class iterable? ";
- var_dump($rc->isIterateable());
+ $rc = new ReflectionClass($class);
+ echo "Is $class iterable? ";
+ var_dump($rc->isIterateable());
}
-echo "\nTest invalid params:\n";
-$rc = new ReflectionClass('IteratorImpl');
-var_dump($rc->isIterateable(null));
-var_dump($rc->isIterateable(null, null));
-var_dump($rc->isIterateable(1));
-var_dump($rc->isIterateable(1.5));
-var_dump($rc->isIterateable(true));
-var_dump($rc->isIterateable('X'));
-var_dump($rc->isIterateable(null));
-
echo "\nTest static invocation:\n";
ReflectionClass::isIterateable();
@@ -61,32 +51,9 @@ Is ExtendsIteratorImpl iterable? bool(true)
Is ExtendsIteratorAggregateImpl iterable? bool(true)
Is A iterable? bool(false)
-Test invalid params:
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 34
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 2 given in %s on line 35
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 36
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 37
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 38
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 39
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 40
-NULL
-
Test static invocation:
-Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:43
+Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 43
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
index 8b65b9a0bd..f11433eced 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
@@ -6,25 +6,25 @@ Felix De Vliegher <felix.devliegher@gmail.com>, Marc Veldman <marc@ibuildings.nl
<?php
class IteratorClass implements Iterator {
- public function __construct() { }
- public function key() {}
- public function current() {}
- function next() {}
- function valid() {}
- function rewind() {}
+ public function __construct() { }
+ public function key() {}
+ public function current() {}
+ function next() {}
+ function valid() {}
+ function rewind() {}
}
class DerivedClass extends IteratorClass {}
class NonIterator {}
function dump_iterateable($class) {
- $reflection = new ReflectionClass($class);
- var_dump($reflection->isIterateable());
+ $reflection = new ReflectionClass($class);
+ var_dump($reflection->isIterateable());
}
$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
- echo "Is $class iterateable? ";
- dump_iterateable($class);
+ echo "Is $class iterateable? ";
+ dump_iterateable($class);
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt
index f6d0d5346a..839867893a 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt
@@ -9,8 +9,8 @@ class BasicClass {}
function dump_iterateable($obj)
{
- $reflection = new ReflectionClass($obj);
- var_dump($reflection->isIterateable());
+ $reflection = new ReflectionClass($obj);
+ var_dump($reflection->isIterateable());
}
$basicClass = new BasicClass();
diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
index 368ea7d7ec..6d4ae500a9 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
@@ -10,39 +10,35 @@ $rc = new ReflectionClass('A');
echo "\n\nTest bad arguments:\n";
try {
- var_dump($rc->isSubclassOf());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->isSubclassOf());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->isSubclassOf('C', 'C'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf(null));
+ var_dump($rc->isSubclassOf(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf('ThisClassDoesNotExist'));
+ var_dump($rc->isSubclassOf('ThisClassDoesNotExist'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf(2));
+ var_dump($rc->isSubclassOf(2));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Test bad arguments:
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12
-NULL
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, null given
Class ThisClassDoesNotExist does not exist
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, int given
diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt
index c05ec27ccd..a52611fb21 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt
@@ -12,17 +12,17 @@ class X implements I {}
$classNames = array('A', 'B', 'C', 'I', 'X');
foreach ($classNames as $className) {
- $rcs[$className] = new ReflectionClass($className);
+ $rcs[$className] = new ReflectionClass($className);
}
foreach ($rcs as $childName => $child) {
- foreach ($rcs as $parentName => $parent) {
- echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
- echo " - Using object argument: ";
- var_dump($child->isSubclassOf($parent));
- echo " - Using string argument: ";
- var_dump($child->isSubclassOf($parentName));
- }
+ foreach ($rcs as $parentName => $parent) {
+ echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
+ echo " - Using object argument: ";
+ var_dump($child->isSubclassOf($parent));
+ echo " - Using string argument: ";
+ var_dump($child->isSubclassOf($parentName));
+ }
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_error2.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_error2.phpt
index 8671c2500b..df7fb42073 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_error2.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_error2.phpt
@@ -11,7 +11,7 @@ class Base {}
$check = function () {
$base = Base::class;
foreach (get_declared_classes() as $class) {
- if (strpos($class, 'class@anonymous') === false) {
+ if (strpos($class, '@anonymous') === false) {
continue;
}
echo "Checking for $class\n";
@@ -30,6 +30,6 @@ echo "Done\n";
?>
--EXPECTF--
After first check
-Checking for class@%s
+Checking for Base@%s
true
Done
diff --git a/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt b/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt
index e9537c1e8a..ee2206177d 100644
--- a/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionClass("Exception");
$r5 = new ReflectionClass("C");
var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(),
- $r4->isUserDefined(), $r5->isUserDefined());
+ $r4->isUserDefined(), $r5->isUserDefined());
?>
--EXPECT--
bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
index 1370228f04..cb2a6555f1 100644
--- a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
@@ -14,11 +14,11 @@ interface I {}
$classes = array("A", "B", "C", "D", "I");
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
- var_dump($rc->isFinal());
- var_dump($rc->isInterface());
- var_dump($rc->isAbstract());
- var_dump($rc->getModifiers());
+ $rc = new ReflectionClass($class);
+ var_dump($rc->isFinal());
+ var_dump($rc->isInterface());
+ var_dump($rc->isAbstract());
+ var_dump($rc->getModifiers());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
index 068710311d..7dded54d3f 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
@@ -5,93 +5,66 @@ Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
-class A {
- public function A() {
- echo "In constructor of class A\n";
- }
-}
class B {
- public function __construct($a, $b) {
- echo "In constructor of class B with args $a, $b\n";
- }
+ public function __construct($a, $b) {
+ echo "In constructor of class B with args $a, $b\n";
+ }
}
class C {
- protected function __construct() {
- echo "In constructor of class C\n";
- }
+ protected function __construct() {
+ echo "In constructor of class C\n";
+ }
}
class D {
- private function __construct() {
- echo "In constructor of class D\n";
- }
+ private function __construct() {
+ echo "In constructor of class D\n";
+ }
}
class E {
}
-$rcA = new ReflectionClass('A');
$rcB = new ReflectionClass('B');
$rcC = new ReflectionClass('C');
$rcD = new ReflectionClass('D');
$rcE = new ReflectionClass('E');
try {
- var_dump($rcA->newInstanceArgs());
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-try {
- var_dump($rcA->newInstanceArgs(array('x')));
+ $rcB->newInstanceArgs();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
-try {
- var_dump($rcB->newInstanceArgs());
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-try {
- var_dump($rcB->newInstanceArgs(array('x', 123)));
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
+var_dump($rcB->newInstanceArgs(array('x', 123)));
try {
- $rcC->newInstanceArgs();
- echo "you should not see this\n";
+ $rcC->newInstanceArgs();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $rcD->newInstanceArgs();
- echo "you should not see this\n";
+ $rcD->newInstanceArgs();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$e1 = $rcE->newInstanceArgs();
var_dump($e1);
try {
- $e2 = $rcE->newInstanceArgs(array('x'));
- echo "you should not see this\n";
+ $e2 = $rcE->newInstanceArgs(array('x'));
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-In constructor of class A
-object(A)#%d (0) {
-}
-In constructor of class A
-object(A)#%d (0) {
-}
Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected
In constructor of class B with args x, 123
object(B)#%d (0) {
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
index bd27dfc173..e7256ea2cb 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
@@ -6,9 +6,9 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- public function __construct($a, $b) {
- echo "In constructor of class B with arg $a\n";
- }
+ public function __construct($a, $b) {
+ echo "In constructor of class B with arg $a\n";
+ }
}
$rc = new ReflectionClass('A');
$a = $rc->newInstanceArgs('x');
@@ -16,8 +16,8 @@ var_dump($a);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to ReflectionClass::newInstanceArgs() must be of the type array, string given in %s:8
+Fatal error: Uncaught TypeError: ReflectionClass::newInstanceArgs(): Argument #1 ($args) must be of type array, string given in %s:%d
Stack trace:
#0 %s(%d): ReflectionClass->newInstanceArgs('x')
#1 {main}
- thrown in %s on line 8
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
index c91d2ee958..22d06e3282 100644
--- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
@@ -5,86 +5,69 @@ Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
-class A {
- public function A() {
- echo "In constructor of class A\n";
- }
-}
class B {
- public function __construct($a, $b) {
- echo "In constructor of class B with args $a, $b\n";
- }
+ public function __construct($a, $b) {
+ echo "In constructor of class B with args $a, $b\n";
+ }
}
class C {
- protected function __construct() {
- echo "In constructor of class C\n";
- }
+ protected function __construct() {
+ echo "In constructor of class C\n";
+ }
}
class D {
- private function __construct() {
- echo "In constructor of class D\n";
- }
+ private function __construct() {
+ echo "In constructor of class D\n";
+ }
}
+
class E {
}
-
-$rcA = new ReflectionClass('A');
$rcB = new ReflectionClass('B');
$rcC = new ReflectionClass('C');
$rcD = new ReflectionClass('D');
$rcE = new ReflectionClass('E');
-$a1 = $rcA->newInstance();
-$a2 = $rcA->newInstance('x');
-var_dump($a1, $a2);
-
try {
- var_dump($rcB->newInstance());
+ var_dump($rcB->newInstance());
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- var_dump($rcB->newInstance('x', 123));
+ var_dump($rcB->newInstance('x', 123));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- $rcC->newInstance();
- echo "you should not see this\n";
+ $rcC->newInstance();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $rcD->newInstance();
- echo "you should not see this\n";
+ $rcD->newInstance();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$e1 = $rcE->newInstance();
var_dump($e1);
try {
- $e2 = $rcE->newInstance('x');
- echo "you should not see this\n";
+ $e2 = $rcE->newInstance('x');
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-In constructor of class A
-In constructor of class A
-object(A)#%d (0) {
-}
-object(A)#%d (0) {
-}
Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected
In constructor of class B with args x, 123
object(B)#%d (0) {
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
index bfefce369e..f51f4136b1 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
@@ -6,15 +6,15 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- static private $privateOverridden = "original private";
- static protected $protectedOverridden = "original protected";
- static public $publicOverridden = "original public";
+ static private $privateOverridden = "original private";
+ static protected $protectedOverridden = "original protected";
+ static public $publicOverridden = "original public";
}
class B extends A {
- static private $privateOverridden = "changed private";
- static protected $protectedOverridden = "changed protected";
- static public $publicOverridden = "changed public";
+ static private $privateOverridden = "changed private";
+ static protected $protectedOverridden = "changed protected";
+ static public $publicOverridden = "changed public";
}
echo "Set static values in A:\n";
@@ -35,17 +35,17 @@ print_r($rcB->getStaticProperties());
echo "\nSet non-existent values from A with no default value:\n";
try {
- var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8"));
- echo "you should not see this";
+ var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9"));
- echo "you should not see this";
+ var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
index fb472681ca..b9bb76c786 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
@@ -6,54 +6,47 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public static $x;
+ public static $x;
}
$rc = new ReflectionClass('C');
try {
- var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(null));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue(null));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(null,null));
+ var_dump($rc->setStaticPropertyValue(null,null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(1.5, 'def'));
+ var_dump($rc->setStaticPropertyValue(1.5, 'def'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given in %s on line 13
-NULL
-
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given in %s on line 18
-NULL
+--EXPECT--
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given
Class C does not have a property named
Class C does not have a property named 1.5
-
-Warning: ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 33
-NULL
+ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
index a83900a123..959cc1bea0 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
@@ -11,7 +11,7 @@ class Test {
$rc = new ReflectionClass('Test');
try {
- $rc->setStaticPropertyValue("y", "foo");
+ $rc->setStaticPropertyValue("y", "foo");
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump(Test::$y);
@@ -22,7 +22,7 @@ var_dump(Test::$y);
Test::$x =& Test::$y;
try {
- $rc->setStaticPropertyValue("x", "foo");
+ $rc->setStaticPropertyValue("x", "foo");
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump(Test::$y);
@@ -31,7 +31,7 @@ var_dump(Test::$y);
?>
--EXPECT--
-Typed property Test::$y must be int, string used
+Cannot assign string to property Test::$y of type int
int(2)
int(21)
Cannot assign string to reference held by property Test::$y of type int
diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt
index 2cfd808cb8..367645d019 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -9,7 +9,7 @@ $rc = new ReflectionClass("ReflectionClass");
echo $rc;
?>
--EXPECT--
-Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
+Class [ <internal:Reflection> class ReflectionClass implements Reflector, Stringable ] {
- Constants [3] {
Constant [ public int IS_IMPLICIT_ABSTRACT ] { 16 }
@@ -20,18 +20,11 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
- Static properties [0] {
}
- - Static methods [1] {
- Method [ <internal, deprecated:Reflection> static public method export ] {
-
- - Parameters [2] {
- Parameter #0 [ <required> $argument ]
- Parameter #1 [ <optional> $return ]
- }
- }
+ - Static methods [0] {
}
- Properties [1] {
- Property [ <default> public $name ]
+ Property [ public $name = '' ]
}
- Methods [53] {
@@ -48,10 +41,11 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
}
}
- Method [ <internal:Reflection, prototype Reflector> public method __toString ] {
+ Method [ <internal:Reflection, prototype Stringable> public method __toString ] {
- Parameters [0] {
}
+ - Return [ string ]
}
Method [ <internal:Reflection> public method getName ] {
@@ -123,49 +117,49 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method hasMethod ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getMethod ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getMethods ] {
- Parameters [1] {
- Parameter #0 [ <optional> $filter ]
+ Parameter #0 [ <optional> ?int $filter = null ]
}
}
Method [ <internal:Reflection> public method hasProperty ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getProperty ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getProperties ] {
- Parameters [1] {
- Parameter #0 [ <optional> $filter ]
+ Parameter #0 [ <optional> ?int $filter = null ]
}
}
Method [ <internal:Reflection> public method hasConstant ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
@@ -184,14 +178,14 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method getConstant ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getReflectionConstant ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
@@ -258,14 +252,14 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method isInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $object ]
+ Parameter #0 [ <required> object $object ]
}
}
Method [ <internal:Reflection> public method newInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $args ]
+ Parameter #0 [ <optional> ...$args = <default> ]
}
}
@@ -278,7 +272,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method newInstanceArgs ] {
- Parameters [1] {
- Parameter #0 [ <optional> array $args ]
+ Parameter #0 [ <optional> array $args = [] ]
}
}
@@ -304,15 +298,15 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method getStaticPropertyValue ] {
- Parameters [2] {
- Parameter #0 [ <required> $name ]
- Parameter #1 [ <optional> $default ]
+ Parameter #0 [ <required> string $name ]
+ Parameter #1 [ <optional> $default = <default> ]
}
}
Method [ <internal:Reflection> public method setStaticPropertyValue ] {
- Parameters [2] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
Parameter #1 [ <required> $value ]
}
}
diff --git a/ext/reflection/tests/ReflectionClass_toString_002.phpt b/ext/reflection/tests/ReflectionClass_toString_002.phpt
index 5395ae66b9..a6824e540d 100644
--- a/ext/reflection/tests/ReflectionClass_toString_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_002.phpt
@@ -6,21 +6,21 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
Class A {
- function f() {}
+ function f() {}
}
Class B extends A {
- function f() {}
+ function f() {}
}
Class C extends B {
}
Class D extends C {
- function f() {}
+ function f() {}
}
foreach (array('A', 'B', 'C', 'D') as $class) {
- echo "\n\n----( Reflection class $class: )----\n";
- $rc = new ReflectionClass($class);
- echo $rc;
+ echo "\n\n----( Reflection class $class: )----\n";
+ $rc = new ReflectionClass($class);
+ echo $rc;
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_toString_003.phpt b/ext/reflection/tests/ReflectionClass_toString_003.phpt
index 1ce1fddf91..a67d0bfac5 100644
--- a/ext/reflection/tests/ReflectionClass_toString_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_003.phpt
@@ -6,21 +6,21 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
Class A {
- private function f() {}
+ private function f() {}
}
Class B extends A {
- private function f() {}
+ private function f() {}
}
Class C extends B {
}
Class D extends C {
- private function f() {}
+ private function f() {}
}
foreach (array('A', 'B', 'C', 'D') as $class) {
- echo "\n\n----( Reflection class $class: )----\n";
- $rc = new ReflectionClass($class);
- echo $rc;
+ echo "\n\n----( Reflection class $class: )----\n";
+ $rc = new ReflectionClass($class);
+ echo $rc;
}
?>
diff --git a/ext/reflection/tests/ReflectionExtension_bug66218.phpt b/ext/reflection/tests/ReflectionExtension_bug66218.phpt
index 77f3d230b3..f42967c089 100644
--- a/ext/reflection/tests/ReflectionExtension_bug66218.phpt
+++ b/ext/reflection/tests/ReflectionExtension_bug66218.phpt
@@ -2,7 +2,6 @@
ReflectionExtension::getFunctions() ##6218 zend_register_functions breaks reflection
--SKIPIF--
<?php
-if (PHP_SAPI != "cli") die("skip CLI only test");
if (!function_exists("dl")) die("skip need dl");
?>
--FILE--
diff --git a/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt b/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt
index 72c8ac6bd8..25a4bbf4b8 100644
--- a/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt
@@ -9,7 +9,5 @@ $obj = new ReflectionExtension('reflection');
$test = $obj instanceof ReflectionExtension;
var_dump($test);
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt
index 94071de5ab..ccf2414e43 100644
--- a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt
+++ b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt
@@ -6,28 +6,26 @@ Leon Luijkx <leon@phpgg.nl>
--FILE--
<?php
try {
- $obj = new ReflectionExtension();
+ $obj = new ReflectionExtension();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $obj = new ReflectionExtension('foo', 'bar');
+ $obj = new ReflectionExtension('foo', 'bar');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $obj = new ReflectionExtension([]);
+ $obj = new ReflectionExtension([]);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
?>
-==DONE==
--EXPECTF--
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
-Ok - ReflectionExtension::__construct() expects parameter 1 to be string, array given
-==DONE==
+Ok - ReflectionExtension::__construct(): Argument #1 ($name) must be of type string, array given
diff --git a/ext/reflection/tests/ReflectionExtension_export_basic.phpt b/ext/reflection/tests/ReflectionExtension_export_basic.phpt
deleted file mode 100644
index 4652a409a1..0000000000
--- a/ext/reflection/tests/ReflectionExtension_export_basic.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-ReflectionExtension::export()
---CREDITS--
-Gerrit "Remi" te Sligte <remi@wolerized.com>
-Leon Luijkx <leon@phpgg.nl>
---FILE--
-<?php
-ReflectionExtension::export("reflection", true);
-ob_start();
-ReflectionExtension::export("reflection", false);
-$test = ob_get_clean();
-var_dump(empty($test));
-?>
-==DONE==
---EXPECTF--
-Deprecated: Function ReflectionExtension::export() is deprecated in %s on line %d
-bool(false)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
index 3fea08c43f..e90209ee67 100644
--- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
@@ -7,7 +7,6 @@ Felix De Vliegher <felix.devliegher@gmail.com>
$standard = new ReflectionExtension('standard');
var_dump($standard->getClassNames());
?>
-==DONE==
--EXPECTF--
array(4) {
[0]=>
@@ -19,4 +18,3 @@ array(4) {
[3]=>
%s(14) "AssertionError"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt
index 91912b9220..34f6112d98 100644
--- a/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt
@@ -11,8 +11,6 @@ extension_loaded('ctype') or die("skip Requires 'ctype' extension");
$extension = new ReflectionExtension('ctype');
var_dump($extension->getClassNames());
?>
-==DONE==
--EXPECT--
array(0) {
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
index 5877f88e27..61a0d24b08 100644
--- a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
@@ -7,9 +7,8 @@ Thijs Lensselink <tl@lenss.nl>
$ext = new ReflectionExtension('reflection');
var_dump($ext->getClasses());
?>
-==DONE==
--EXPECT--
-array(17) {
+array(18) {
["ReflectionException"]=>
object(ReflectionClass)#2 (1) {
["name"]=>
@@ -55,45 +54,49 @@ array(17) {
["name"]=>
string(19) "ReflectionNamedType"
}
- ["ReflectionMethod"]=>
+ ["ReflectionUnionType"]=>
object(ReflectionClass)#11 (1) {
["name"]=>
+ string(19) "ReflectionUnionType"
+ }
+ ["ReflectionMethod"]=>
+ object(ReflectionClass)#12 (1) {
+ ["name"]=>
string(16) "ReflectionMethod"
}
["ReflectionClass"]=>
- object(ReflectionClass)#12 (1) {
+ object(ReflectionClass)#13 (1) {
["name"]=>
string(15) "ReflectionClass"
}
["ReflectionObject"]=>
- object(ReflectionClass)#13 (1) {
+ object(ReflectionClass)#14 (1) {
["name"]=>
string(16) "ReflectionObject"
}
["ReflectionProperty"]=>
- object(ReflectionClass)#14 (1) {
+ object(ReflectionClass)#15 (1) {
["name"]=>
string(18) "ReflectionProperty"
}
["ReflectionClassConstant"]=>
- object(ReflectionClass)#15 (1) {
+ object(ReflectionClass)#16 (1) {
["name"]=>
string(23) "ReflectionClassConstant"
}
["ReflectionExtension"]=>
- object(ReflectionClass)#16 (1) {
+ object(ReflectionClass)#17 (1) {
["name"]=>
string(19) "ReflectionExtension"
}
["ReflectionZendExtension"]=>
- object(ReflectionClass)#17 (1) {
+ object(ReflectionClass)#18 (1) {
["name"]=>
string(23) "ReflectionZendExtension"
}
["ReflectionReference"]=>
- object(ReflectionClass)#18 (1) {
+ object(ReflectionClass)#19 (1) {
["name"]=>
string(19) "ReflectionReference"
}
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt b/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt
index 8b5293a48f..306380c9d1 100644
--- a/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt
@@ -11,7 +11,6 @@ if (!extension_loaded("dom")) die("skip no dom extension");
$dom = new ReflectionExtension('dom');
var_dump($dom->getDependencies());
?>
-==DONE==
--EXPECTF--
array(2) {
["libxml"]=>
@@ -19,4 +18,3 @@ array(2) {
["domxml"]=>
%s(9) "Conflicts"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt b/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt
index 5b0ade5da2..be13fe27a8 100644
--- a/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt
@@ -7,10 +7,8 @@ Felix De Vliegher <felix.devliegher@gmail.com>
$standard = new ReflectionExtension('standard');
var_dump($standard->getDependencies());
?>
-==DONE==
--EXPECTF--
array(1) {
["session"]=>
%s(8) "Optional"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getName_basic.phpt b/ext/reflection/tests/ReflectionExtension_getName_basic.phpt
index 9dae1f3a6b..c26044f710 100644
--- a/ext/reflection/tests/ReflectionExtension_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getName_basic.phpt
@@ -8,7 +8,5 @@ Leon Luijkx <leon@phpgg.nl>
$obj = new ReflectionExtension('reflection');
var_dump($obj->getName());
?>
-==DONE==
--EXPECT--
string(10) "Reflection"
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt b/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt
index 19dee82710..0139a1c4ae 100644
--- a/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt
@@ -10,7 +10,5 @@ $var = $obj->getVersion() ? $obj->getVersion() : null;
$test = floatval($var) == $var ? true : false;
var_dump($test);
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_info_basic.phpt b/ext/reflection/tests/ReflectionExtension_info_basic.phpt
index 48f6a65099..6eac5a56e7 100644
--- a/ext/reflection/tests/ReflectionExtension_info_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_info_basic.phpt
@@ -12,8 +12,6 @@ $testb = ob_get_clean();
var_dump($testa);
var_dump(strlen($testb) > 24);
?>
-==DONE==
--EXPECT--
NULL
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
index a78a8bbc3d..642a79bd3b 100644
--- a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
+++ b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
@@ -5,7 +5,5 @@ ReflectionExtension::isPersistent()
$obj = new ReflectionExtension('reflection');
var_dump($obj->isPersistent());
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
index be97641be1..791662ff13 100644
--- a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
+++ b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
@@ -5,7 +5,5 @@ ReflectionExtension::isTemporary()
$obj = new ReflectionExtension('reflection');
var_dump($obj->isTemporary());
?>
-==DONE==
--EXPECT--
bool(false)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionFunction_001.phpt b/ext/reflection/tests/ReflectionFunction_001.phpt
index 6785e5d0b1..4c0a58ca9d 100644
--- a/ext/reflection/tests/ReflectionFunction_001.phpt
+++ b/ext/reflection/tests/ReflectionFunction_001.phpt
@@ -10,10 +10,10 @@ Steve Seear <stevseea@php.net>
* my doc comment
*/
function foo () {
- static $c;
- static $a = 1;
- static $b = "hello";
- $d = 5;
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
}
/***
@@ -23,13 +23,13 @@ function bar () {}
function dumpFuncInfo($name) {
- $funcInfo = new ReflectionFunction($name);
- var_dump($funcInfo->getName());
- var_dump($funcInfo->isInternal());
- var_dump($funcInfo->isUserDefined());
- var_dump($funcInfo->getStartLine());
- var_dump($funcInfo->getEndLine());
- var_dump($funcInfo->getStaticVariables());
+ $funcInfo = new ReflectionFunction($name);
+ var_dump($funcInfo->getName());
+ var_dump($funcInfo->isInternal());
+ var_dump($funcInfo->isUserDefined());
+ var_dump($funcInfo->getStartLine());
+ var_dump($funcInfo->getEndLine());
+ var_dump($funcInfo->getStaticVariables());
}
dumpFuncInfo('foo');
diff --git a/ext/reflection/tests/ReflectionFunction_construct.001.phpt b/ext/reflection/tests/ReflectionFunction_construct.001.phpt
index eab542e005..1772ba5b68 100644
--- a/ext/reflection/tests/ReflectionFunction_construct.001.phpt
+++ b/ext/reflection/tests/ReflectionFunction_construct.001.phpt
@@ -7,36 +7,36 @@ Steve Seear <stevseea@php.net>
<?php
try {
- $a = new ReflectionFunction(array(1, 2, 3));
- echo "exception not thrown.".PHP_EOL;
+ $a = new ReflectionFunction(array(1, 2, 3));
+ echo "exception not thrown.".PHP_EOL;
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction('nonExistentFunction');
+ $a = new ReflectionFunction('nonExistentFunction');
} catch (ReflectionException $e) {
- echo $e->getMessage().PHP_EOL;
+ echo $e->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction();
+ $a = new ReflectionFunction();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction(1, 2);
+ $a = new ReflectionFunction(1, 2);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction([]);
+ $a = new ReflectionFunction([]);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
?>
--EXPECT--
-Ok - ReflectionFunction::__construct() expects parameter 1 to be string, array given
+Ok - ReflectionFunction::__construct(): Argument #1 ($name) must be of type string, array given
Function nonExistentFunction() does not exist
Ok - ReflectionFunction::__construct() expects exactly 1 parameter, 0 given
Ok - ReflectionFunction::__construct() expects exactly 1 parameter, 2 given
-Ok - ReflectionFunction::__construct() expects parameter 1 to be string, array given
+Ok - ReflectionFunction::__construct(): Argument #1 ($name) must be of type string, array given
diff --git a/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt b/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
index b8b969b0bc..f7cb6b36ec 100644
--- a/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
@@ -7,9 +7,9 @@ $rf = new ReflectionFunction($closure);
var_dump($rf->getClosureScopeClass());
Class A {
- public static function getClosure() {
- return function($param) { return "this is a closure"; };
- }
+ public static function getClosure() {
+ return function($param) { return "this is a closure"; };
+ }
}
$closure = A::getClosure();
diff --git a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt
index 4c76959aec..7772da0509 100644
--- a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt
@@ -12,12 +12,12 @@ echo "*** Testing ReflectionFunction::getClosure() : basic functionality ***\n";
function foo()
{
- var_dump( "Inside foo function" );
+ var_dump( "Inside foo function" );
}
function bar( $arg )
{
- var_dump( "Arg is " . $arg );
+ var_dump( "Arg is " . $arg );
}
$func = new ReflectionFunction( 'foo' );
@@ -29,9 +29,7 @@ $closure = $func->getClosure();
$closure( 'succeeded' );
?>
-===DONE===
--EXPECT--
*** Testing ReflectionFunction::getClosure() : basic functionality ***
string(19) "Inside foo function"
string(16) "Arg is succeeded"
-===DONE===
diff --git a/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt b/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt
index 03cec2ee79..590f5cfa10 100644
--- a/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt
@@ -12,10 +12,10 @@ opcache.save_comments=1
* my doc comment
*/
function foo () {
- static $c;
- static $a = 1;
- static $b = "hello";
- $d = 5;
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
}
/***
@@ -25,8 +25,8 @@ function bar () {}
function dumpFuncInfo($name) {
- $funcInfo = new ReflectionFunction($name);
- var_dump($funcInfo->getDocComment());
+ $funcInfo = new ReflectionFunction($name);
+ var_dump($funcInfo->getDocComment());
}
dumpFuncInfo('foo');
diff --git a/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt b/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt
index cd75418584..39fa48a3ff 100644
--- a/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt
@@ -10,10 +10,10 @@ Steve Seear <stevseea@php.net>
* my doc comment
*/
function foo () {
- static $c;
- static $a = 1;
- static $b = "hello";
- $d = 5;
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
}
/***
@@ -23,8 +23,8 @@ function bar () {}
function dumpFuncInfo($name) {
- $funcInfo = new ReflectionFunction($name);
- var_dump($funcInfo->getFileName());
+ $funcInfo = new ReflectionFunction($name);
+ var_dump($funcInfo->getFileName());
}
dumpFuncInfo('foo');
diff --git a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
index 8bbbfa516f..b9a84d49c4 100644
--- a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
+++ b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
@@ -5,7 +5,7 @@ ReflectionFunction::isGenerator()
$closure1 = function() {return "this is a closure"; };
$closure2 = function($param) {
- yield $param;
+ yield $param;
};
$rf1 = new ReflectionFunction($closure1);
@@ -15,11 +15,11 @@ $rf2 = new ReflectionFunction($closure2);
var_dump($rf2->isGenerator());
function func1() {
- return 'func1';
+ return 'func1';
}
function func2() {
- yield 'func2';
+ yield 'func2';
}
$rf1 = new ReflectionFunction('func1');
@@ -30,17 +30,17 @@ var_dump($rf2->isGenerator());
class Foo {
- public function f1() {
- }
+ public function f1() {
+ }
- public function f2() {
- yield;
- }
+ public function f2() {
+ yield;
+ }
}
$rc = new ReflectionClass('Foo');
foreach($rc->getMethods() as $m) {
- var_dump($m->isGenerator());
+ var_dump($m->isGenerator());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionGenerator_basic.phpt b/ext/reflection/tests/ReflectionGenerator_basic.phpt
index 6f35b6c244..f9ecc8e90e 100644
--- a/ext/reflection/tests/ReflectionGenerator_basic.phpt
+++ b/ext/reflection/tests/ReflectionGenerator_basic.phpt
@@ -4,33 +4,33 @@ ReflectionGenerator basic test
<?php
function foo() {
- yield;
+ yield;
}
$gens = [
- (new class() {
- function a() {
- yield from foo();
- }
- })->a(),
- (function() {
- yield;
- })(),
- foo(),
+ (new class() {
+ function a() {
+ yield from foo();
+ }
+ })->a(),
+ (function() {
+ yield;
+ })(),
+ foo(),
];
foreach ($gens as $gen) {
- var_dump($gen);
+ var_dump($gen);
- $gen->valid(); // start Generator
- $ref = new ReflectionGenerator($gen);
+ $gen->valid(); // start Generator
+ $ref = new ReflectionGenerator($gen);
- var_dump($ref->getTrace());
- var_dump($ref->getExecutingLine());
- var_dump($ref->getExecutingFile());
- var_dump($ref->getExecutingGenerator());
- var_dump($ref->getFunction());
- var_dump($ref->getThis());
+ var_dump($ref->getTrace());
+ var_dump($ref->getExecutingLine());
+ var_dump($ref->getExecutingFile());
+ var_dump($ref->getExecutingGenerator());
+ var_dump($ref->getFunction());
+ var_dump($ref->getThis());
}
?>
diff --git a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
index 05a46009e8..91b7160d4b 100644
--- a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
+++ b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
@@ -4,8 +4,8 @@ ReflectionGenerator::getTrace() over multiple Generators
<?php
function foo() {
- yield 1;
- yield 2;
+ yield 1;
+ yield 2;
}
function bar()
diff --git a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt
index a227e1a213..a665d45c30 100644
--- a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt
+++ b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt
@@ -4,31 +4,31 @@ ReflectionGenerator while being currently executed
<?php
function call(ReflectionGenerator $ref, $method, $rec = true) {
- if ($rec) {
- call($ref, $method, false);
- return;
- }
- var_dump($ref->$method());
+ if ($rec) {
+ call($ref, $method, false);
+ return;
+ }
+ var_dump($ref->$method());
}
function doCalls(ReflectionGenerator $ref) {
- call($ref, "getTrace");
- call($ref, "getExecutingLine");
- call($ref, "getExecutingFile");
- call($ref, "getExecutingGenerator");
- call($ref, "getFunction");
- call($ref, "getThis");
+ call($ref, "getTrace");
+ call($ref, "getExecutingLine");
+ call($ref, "getExecutingFile");
+ call($ref, "getExecutingGenerator");
+ call($ref, "getFunction");
+ call($ref, "getThis");
}
($gen = (function() use (&$gen) {
- $ref = new ReflectionGenerator($gen);
+ $ref = new ReflectionGenerator($gen);
- doCalls($ref);
+ doCalls($ref);
- yield from (function() use ($ref) {
- doCalls($ref);
- yield; // Generator !
- })();
+ yield from (function() use ($ref) {
+ doCalls($ref);
+ yield; // Generator !
+ })();
})())->next();
?>
diff --git a/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt
index 627dc96f32..bb29b1cbed 100644
--- a/ext/reflection/tests/ReflectionMethod_006.phpt
+++ b/ext/reflection/tests/ReflectionMethod_006.phpt
@@ -7,89 +7,17 @@ Steve Seear <stevseea@php.net>
<?php
try {
- new ReflectionMethod();
+ new ReflectionMethod();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- new ReflectionMethod('a', 'b', 'c');
+ new ReflectionMethod('a', 'b', 'c');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
-class C {
- public function f() {}
-}
-
-$rm = new ReflectionMethod('C', 'f');
-
-var_dump($rm->isFinal(1));
-var_dump($rm->isAbstract(1));
-var_dump($rm->isPrivate(1));
-var_dump($rm->isProtected(1));
-var_dump($rm->isPublic(1));
-var_dump($rm->isStatic(1));
-var_dump($rm->isConstructor(1));
-var_dump($rm->isDestructor(1));
-var_dump($rm->getModifiers(1));
-var_dump($rm->isInternal(1));
-var_dump($rm->isUserDefined(1));
-var_dump($rm->getFileName(1));
-var_dump($rm->getStartLine(1));
-var_dump($rm->getEndLine(1));
-var_dump($rm->getStaticVariables(1));
-var_dump($rm->getName(1));
-
-
?>
---EXPECTF--
+--EXPECT--
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
-
-Warning: ReflectionMethod::isFinal() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isAbstract() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isConstructor() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isDestructor() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::isInternal() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::isUserDefined() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getFileName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getStartLine() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getEndLine() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getStaticVariables() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionMethod_basic2.phpt b/ext/reflection/tests/ReflectionMethod_basic2.phpt
index 71ef9e95d9..f7d4b9f4d6 100644
--- a/ext/reflection/tests/ReflectionMethod_basic2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_basic2.phpt
@@ -1,5 +1,5 @@
--TEST--
-ReflectionMethod class __toString() and export() methods
+ReflectionMethod class __toString() method
--FILE--
<?php
@@ -9,8 +9,6 @@ function reflectMethod($class, $method) {
echo "Reflecting on method $class::$method()\n\n";
echo "__toString():\n";
var_dump($methodInfo->__toString());
- echo "\nexport():\n";
- var_dump(ReflectionMethod::export($class, $method, true));
echo "\n**********************************\n";
}
@@ -55,15 +53,7 @@ Reflecting on method DerivedClass::foo()
__toString():
string(%d) "Method [ <user, inherits TestClass> public method foo ] {
- @@ %s 16 - 18
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user, inherits TestClass> public method foo ] {
- @@ %s 16 - 18
+ @@ %s 14 - 16
}
"
@@ -73,15 +63,7 @@ Reflecting on method TestClass::stat()
__toString():
string(%d) "Method [ <user> static public method stat ] {
- @@ %s 20 - 22
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> static public method stat ] {
- @@ %s 20 - 22
+ @@ %s 18 - 20
}
"
@@ -91,15 +73,7 @@ Reflecting on method TestClass::priv()
__toString():
string(%d) "Method [ <user> private method priv ] {
- @@ %s 24 - 26
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> private method priv ] {
- @@ %s 24 - 26
+ @@ %s 22 - 24
}
"
@@ -109,15 +83,7 @@ Reflecting on method TestClass::prot()
__toString():
string(%d) "Method [ <user> protected method prot ] {
- @@ %s 28 - 28
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> protected method prot ] {
- @@ %s 28 - 28
+ @@ %s 26 - 26
}
"
@@ -127,15 +93,7 @@ Reflecting on method DerivedClass::prot()
__toString():
string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
- @@ %s 28 - 28
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
- @@ %s 28 - 28
+ @@ %s 26 - 26
}
"
@@ -145,15 +103,7 @@ Reflecting on method TestInterface::int()
__toString():
string(%d) "Method [ <user> abstract public method int ] {
- @@ %s 36 - 36
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> abstract public method int ] {
- @@ %s 36 - 36
+ @@ %s 34 - 34
}
"
@@ -166,19 +116,7 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
- Parameters [2] {
Parameter #0 [ <required> $class ]
- Parameter #1 [ <required> $name ]
- }
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
-
- - Parameters [2] {
- Parameter #0 [ <required> $class ]
- Parameter #1 [ <required> $name ]
+ Parameter #1 [ <required> string $name ]
}
}
"
@@ -189,15 +127,7 @@ Reflecting on method TestClass::__destruct()
__toString():
string(%d) "Method [ <user, dtor> public method __destruct ] {
- @@ %s 30 - 30
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user, dtor> public method __destruct ] {
- @@ %s 30 - 30
+ @@ %s 28 - 28
}
"
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
index 243c59504b..da108d258d 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
@@ -19,21 +19,6 @@ echo "\nInherited new-style constructor\n";
$methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct");
var_dump($methodInfo->isConstructor());
-class OldCtor {
- function OldCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nOld-style constructor:\n";
-$methodInfo = new ReflectionMethod("OldCtor::OldCtor");
-var_dump($methodInfo->isConstructor());
-
-class ExtendsOldCtor extends OldCtor {
-}
-echo "\nInherited old-style constructor:\n";
-$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor");
-var_dump($methodInfo->isConstructor());
-
class X {
function Y() {
echo "In " . __METHOD__ . "\n";
@@ -49,69 +34,16 @@ echo "\nInherited method of the same name as the class:\n";
$methodInfo = new ReflectionMethod("Y::Y");
var_dump($methodInfo->isConstructor());
-class OldAndNewCtor {
- function OldAndNewCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-
- function __construct() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nOld-style constructor:\n";
-$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor");
-var_dump($methodInfo->isConstructor());
-
-echo "\nRedefined constructor:\n";
-$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct");
-var_dump($methodInfo->isConstructor());
-
-class NewAndOldCtor {
- function __construct() {
- echo "In " . __METHOD__ . "\n";
- }
-
- function NewAndOldCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nNew-style constructor:\n";
-$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct");
-var_dump($methodInfo->isConstructor());
-
-echo "\nRedefined old-style constructor:\n";
-$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor");
-var_dump($methodInfo->isConstructor());
-
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
+--EXPECT--
New-style constructor:
bool(true)
Inherited new-style constructor
bool(true)
-Old-style constructor:
-bool(true)
-
-Inherited old-style constructor:
-bool(true)
-
Not a constructor:
bool(false)
Inherited method of the same name as the class:
bool(false)
-
-Old-style constructor:
-bool(false)
-
-Redefined constructor:
-bool(true)
-
-New-style constructor:
-bool(true)
-
-Redefined old-style constructor:
-bool(false)
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
index 5c980536b9..391beced52 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
@@ -14,68 +14,68 @@ class TestClass
try {
- echo "\nWrong type of argument (bool):\n";
- $methodInfo = new ReflectionMethod(true);
+ echo "\nWrong type of argument (bool):\n";
+ $methodInfo = new ReflectionMethod(true);
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nWrong type of argument (int):\n";
- $methodInfo = new ReflectionMethod(3);
+ echo "\nWrong type of argument (int):\n";
+ $methodInfo = new ReflectionMethod(3);
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nWrong type of argument (bool, string):\n";
- $methodInfo = new ReflectionMethod(true, "foo");
+ echo "\nWrong type of argument (bool, string):\n";
+ $methodInfo = new ReflectionMethod(true, "foo");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nWrong type of argument (string, bool):\n";
- $methodInfo = new ReflectionMethod('TestClass', true);
+ echo "\nWrong type of argument (string, bool):\n";
+ $methodInfo = new ReflectionMethod('TestClass', true);
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nNo method given:\n";
- $methodInfo = new ReflectionMethod("TestClass");
+ echo "\nNo method given:\n";
+ $methodInfo = new ReflectionMethod("TestClass");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nClass and Method in same string, bad method name:\n";
- $methodInfo = new ReflectionMethod("TestClass::foop::dedoop");
+ echo "\nClass and Method in same string, bad method name:\n";
+ $methodInfo = new ReflectionMethod("TestClass::foop::dedoop");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nClass and Method in same string, bad class name:\n";
- $methodInfo = new ReflectionMethod("TestCla::foo");
+ echo "\nClass and Method in same string, bad class name:\n";
+ $methodInfo = new ReflectionMethod("TestCla::foo");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nClass and Method in same string (ok):\n";
- $methodInfo = new ReflectionMethod("TestClass::foo");
+ echo "\nClass and Method in same string (ok):\n";
+ $methodInfo = new ReflectionMethod("TestClass::foo");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
?>
--EXPECTF--
Wrong type of argument (bool):
-ReflectionException: Invalid method name 1 in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct('1')
#1 {main}
Wrong type of argument (int):
-ReflectionException: Invalid method name 3 in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct('3')
#1 {main}
Wrong type of argument (bool, string):
-ReflectionException: The parameter class is expected to be either a string or an object in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be of type object|string, bool given in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct(true, 'foo')
#1 {main}
@@ -85,7 +85,7 @@ Stack trace:
#0 %s ReflectionMethod->__construct('TestClass', '1')
#1 {main}
No method given:
-ReflectionException: Invalid method name TestClass in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct('TestClass')
#1 {main}
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt
index 723ab00f84..cf0d3bbbaa 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt
@@ -14,39 +14,39 @@ class TestClass
try {
- echo "Too few arguments:\n";
- $methodInfo = new ReflectionMethod();
+ echo "Too few arguments:\n";
+ $methodInfo = new ReflectionMethod();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- echo "\nToo many arguments:\n";
- $methodInfo = new ReflectionMethod("TestClass", "foo", true);
+ echo "\nToo many arguments:\n";
+ $methodInfo = new ReflectionMethod("TestClass", "foo", true);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- //invalid class
- $methodInfo = new ReflectionMethod("InvalidClassName", "foo");
+ //invalid class
+ $methodInfo = new ReflectionMethod("InvalidClassName", "foo");
} catch (ReflectionException $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- //invalid 1st param
- $methodInfo = new ReflectionMethod([], "foo");
+ //invalid 1st param
+ $methodInfo = new ReflectionMethod([], "foo");
} catch (ReflectionException $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try{
- //invalid 2nd param
- $methodInfo = new ReflectionMethod("TestClass", []);
+ //invalid 2nd param
+ $methodInfo = new ReflectionMethod("TestClass", []);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
?>
@@ -57,5 +57,5 @@ Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given
Too many arguments:
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
Ok - Class InvalidClassName does not exist
-Ok - The parameter class is expected to be either a string or an object
+Ok - ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be of type object|string, array given
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 2 given
diff --git a/ext/reflection/tests/ReflectionMethod_defaultArg.phpt b/ext/reflection/tests/ReflectionMethod_defaultArg.phpt
index 1c04cade5f..521f29da58 100644
--- a/ext/reflection/tests/ReflectionMethod_defaultArg.phpt
+++ b/ext/reflection/tests/ReflectionMethod_defaultArg.phpt
@@ -3,17 +3,17 @@ ReflectionMethod and RECV_INIT (bug #70957 and #70958)
--FILE--
<?php
Abstract class F {
- private function bar($a = self::class) {}
+ private function bar($a = self::class) {}
}
Trait T
{
- private function bar($a = self::class) {}
+ private function bar($a = self::class) {}
}
class B {
- use T;
+ use T;
}
echo new \ReflectionMethod('F', 'bar');
diff --git a/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt b/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt
index 3a931172f1..656fde814d 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt
@@ -4,19 +4,19 @@ Reflection::getClosureThis()
<?php
class StaticExample
{
- static function foo()
- {
- var_dump( "Static Example class, Hello World!" );
- }
+ static function foo()
+ {
+ var_dump( "Static Example class, Hello World!" );
+ }
}
class Example
{
- public $bar = 42;
- public function foo()
- {
- var_dump( "Example class, bar: " . $this->bar );
- }
+ public $bar = 42;
+ public function foo()
+ {
+ var_dump( "Example class, bar: " . $this->bar );
+ }
}
// Initialize classes
diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt
index bf1bcf3603..3b0074e5a9 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt
@@ -12,19 +12,19 @@ echo "*** Testing ReflectionMethod::getClosure() : basic functionality ***\n";
class StaticExample
{
- static function foo()
- {
- var_dump( "Static Example class, Hello World!" );
- }
+ static function foo()
+ {
+ var_dump( "Static Example class, Hello World!" );
+ }
}
class Example
{
- public $bar = 42;
- public function foo()
- {
- var_dump( "Example class, bar: " . $this->bar );
- }
+ public $bar = 42;
+ public function foo()
+ {
+ var_dump( "Example class, bar: " . $this->bar );
+ }
}
// Initialize classes
@@ -46,10 +46,8 @@ $object->bar = 34;
$closure();
?>
-===DONE===
--EXPECT--
*** Testing ReflectionMethod::getClosure() : basic functionality ***
string(34) "Static Example class, Hello World!"
string(22) "Example class, bar: 42"
string(22) "Example class, bar: 34"
-===DONE===
diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
index d3b9ca3c81..728ddf9265 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
@@ -12,19 +12,19 @@ echo "*** Testing ReflectionMethod::getClosure() : error conditions ***\n";
class StaticExample
{
- static function foo()
- {
- var_dump( "Static Example class, Hello World!" );
- }
+ static function foo()
+ {
+ var_dump( "Static Example class, Hello World!" );
+ }
}
class Example
{
- public $bar = 42;
- public function foo()
- {
- var_dump( "Example class, bar: " . $this->bar );
- }
+ public $bar = 42;
+ public function foo()
+ {
+ var_dump( "Example class, bar: " . $this->bar );
+ }
}
// Initialize classes
@@ -35,15 +35,7 @@ $staticmethod = $staticclass->getMethod( 'foo' );
$object = new Example();
$fakeobj = new StdClass();
-echo "\n-- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --\n";
-var_dump( $staticmethod->getClosure( 'foobar' ) );
-var_dump( $staticmethod->getClosure( 'foo', 'bar' ) );
-var_dump( $method->getClosure( $object, 'foobar' ) );
-
-echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n";
-$closure = $method->getClosure();
-
-echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n";
+echo "\n-- Testing ReflectionMethod::getClosure() function with invalid object --\n";
try {
var_dump( $method->getClosure( $fakeobj ) );
} catch( Exception $e ) {
@@ -51,23 +43,8 @@ try {
}
?>
-===DONE===
--EXPECTF--
*** Testing ReflectionMethod::getClosure() : error conditions ***
--- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --
-object(Closure)#%d (0) {
-}
-object(Closure)#%d (0) {
-}
-
-Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing ReflectionMethod::getClosure() function with Zero arguments --
-
-Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in %s on line %d
-
--- Testing ReflectionMethod::getClosure() function with Zero arguments --
+-- Testing ReflectionMethod::getClosure() function with invalid object --
string(72) "Given object is not an instance of the class this method was declared in"
-===DONE===
diff --git a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
index f999b72812..7cda871c18 100644
--- a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
@@ -25,7 +25,7 @@ class A {
* My Doc Comment for A::finalStatPubf
*/
- final static public function finalStatPubf() {}
+ final static public function finalStatPubf() {}
}
diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
index d1a19c7116..70038c31a0 100644
--- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
@@ -60,12 +60,12 @@ class TestClass
class DerivedClass extends TestClass {}
interface TestInterface {
- public function int();
- public function __clone();
+ public function int();
+ public function __clone();
}
abstract class AbstractClass {
- public abstract function foo();
+ public abstract function foo();
}
@@ -75,17 +75,13 @@ reflectMethodModifiers("DerivedClass");
reflectMethodModifiers("TestInterface");
reflectMethodModifiers("AbstractClass");
-echo "Wrong number of params:\n";
-$a = new ReflectionMethod('TestClass::foo');
-$a->getModifiers(1);
-
$a = new ReflectionMethod('ReflectionMethod::getModifiers');
-echo "\nReflectionMethod::getModifiers() modifiers:\n";
+echo "ReflectionMethod::getModifiers() modifiers:\n";
printf("0x%08x\n", $a->getModifiers());
?>
---EXPECTF--
+--EXPECT--
Modifiers for method TestClass::foo():
0x00000001
@@ -162,10 +158,6 @@ Modifiers for method TestClass::stat():
0x00000011
-Modifiers for method TestClass::priv():
-0x00000004
-
-
Modifiers for method TestClass::prot():
0x00000002
@@ -234,9 +226,5 @@ Modifiers for method AbstractClass::foo():
0x00000041
-Wrong number of params:
-
-Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-
ReflectionMethod::getModifiers() modifiers:
0x00000001
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
index 6c81728f91..869682ccdd 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
@@ -24,4 +24,4 @@ try {
?>
--EXPECT--
-string(89) "Argument 2 passed to ReflectionMethod::invokeArgs() must be of the type array, bool given"
+string(85) "ReflectionMethod::invokeArgs(): Argument #2 ($args) must be of type array, bool given"
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
index 0c87a66153..113cabbbeb 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
@@ -15,10 +15,10 @@ class TestClass {
public static function staticMethod() {
echo "Called staticMethod()\n";
try {
- var_dump($this);
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
+ var_dump($this);
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
}
private static function privateMethod() {
@@ -37,10 +37,6 @@ $foo = new ReflectionMethod($testClassInstance, 'foo');
$staticMethod = new ReflectionMethod('TestClass::staticMethod');
$privateMethod = new ReflectionMethod("TestClass::privateMethod");
-echo "Wrong number of parameters:\n";
-var_dump($foo->invokeArgs());
-var_dump($foo->invokeArgs(true));
-
echo "\nNon-instance:\n";
try {
var_dump($foo->invokeArgs(new stdClass(), array()));
@@ -48,14 +44,8 @@ try {
var_dump($e->getMessage());
}
-echo "\nNon-object:\n";
-var_dump($foo->invokeArgs(true, array()));
-
echo "\nStatic method:\n";
-var_dump($staticMethod->invokeArgs());
-var_dump($staticMethod->invokeArgs(true));
-var_dump($staticMethod->invokeArgs(true, array()));
var_dump($staticMethod->invokeArgs(null, array()));
echo "\nPrivate method:\n";
@@ -80,32 +70,10 @@ try {
?>
--EXPECTF--
-Wrong number of parameters:
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Non-instance:
string(72) "Given object is not an instance of the class this method was declared in"
-Non-object:
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
Static method:
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d
-NULL
Called staticMethod()
Exception: Using $this when not in object context
NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
index 0a2b15fb83..73c04a687b 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
@@ -23,10 +23,10 @@ class TestClass {
public static function staticMethod() {
echo "Called staticMethod()\n";
try {
- var_dump($this);
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
+ var_dump($this);
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
}
private static function privateMethod() {
@@ -60,15 +60,23 @@ var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2", 3));
echo "\nStatic method:\n";
-var_dump($staticMethod->invoke());
-var_dump($staticMethod->invoke(true));
+try {
+ var_dump($staticMethod->invoke());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($staticMethod->invoke(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($staticMethod->invoke(new stdClass()));
echo "\nMethod that throws an exception:\n";
try {
- var_dump($methodThatThrows->invoke($testClassInstance));
+ var_dump($methodThatThrows->invoke($testClassInstance));
} catch (Exception $exc) {
- var_dump($exc->getMessage());
+ var_dump($exc->getMessage());
}
?>
@@ -94,12 +102,8 @@ Called methodWithArgs(1, arg2)
NULL
Static method:
-
-Warning: ReflectionMethod::invoke() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s on line %d
-NULL
+ReflectionMethod::invoke() expects at least 1 parameter, 0 given
+ReflectionMethod::invoke(): Argument #1 ($object) must be of type ?object, bool given
Called staticMethod()
Exception: Using $this when not in object context
NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
index 411299f0c7..64a38e18a1 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
@@ -30,7 +30,7 @@ $testClassInstance->prop = "Hello";
echo "invoke() on a non-object:\n";
try {
var_dump($foo->invoke(true));
-} catch (ReflectionException $e) {
+} catch (TypeError $e) {
var_dump($e->getMessage());
}
@@ -57,11 +57,9 @@ try {
}
?>
---EXPECTF--
+--EXPECT--
invoke() on a non-object:
-
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s%eReflectionMethod_invoke_error1.php on line %d
-NULL
+string(85) "ReflectionMethod::invoke(): Argument #1 ($object) must be of type ?object, bool given"
invoke() on a non-instance:
string(72) "Given object is not an instance of the class this method was declared in"
diff --git a/ext/reflection/tests/ReflectionNamedType.phpt b/ext/reflection/tests/ReflectionNamedType.phpt
index afb592127c..5677d22cf2 100644
--- a/ext/reflection/tests/ReflectionNamedType.phpt
+++ b/ext/reflection/tests/ReflectionNamedType.phpt
@@ -4,11 +4,11 @@ ReflectionNamedType::getName() and ReflectionNamedType::__toString()
<?php
function testInternalTypes(?Traversable $traversable): ?string {
- return 'test';
+ return 'test';
}
function testUserDefinedTypes(?Test $traversable): ?Test {
- return new Test;
+ return new Test;
}
$function = new ReflectionFunction('testInternalTypes');
@@ -30,20 +30,12 @@ var_dump($return->getName());
var_dump((string) $return);
?>
---EXPECTF--
+--EXPECT--
string(11) "Traversable"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
-string(11) "Traversable"
-string(6) "string"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+string(12) "?Traversable"
string(6) "string"
+string(7) "?string"
string(4) "Test"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
-string(4) "Test"
-string(4) "Test"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+string(5) "?Test"
string(4) "Test"
+string(5) "?Test"
diff --git a/ext/reflection/tests/ReflectionObject___toString_basic1.phpt b/ext/reflection/tests/ReflectionObject___toString_basic1.phpt
index 43210ea686..9da648f3a2 100644
--- a/ext/reflection/tests/ReflectionObject___toString_basic1.phpt
+++ b/ext/reflection/tests/ReflectionObject___toString_basic1.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with no dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
@@ -25,7 +25,7 @@ Object of class [ <user> class Foo ] {
}
- Properties [1] {
- Property [ <default> public $bar ]
+ Property [ public $bar = 1 ]
}
- Dynamic properties [0] {
diff --git a/ext/reflection/tests/ReflectionObject___toString_basic2.phpt b/ext/reflection/tests/ReflectionObject___toString_basic2.phpt
index 970d07b432..e93dd9b331 100644
--- a/ext/reflection/tests/ReflectionObject___toString_basic2.phpt
+++ b/ext/reflection/tests/ReflectionObject___toString_basic2.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
$f->dynProp = 'hello';
@@ -26,7 +26,7 @@ Object of class [ <user> class Foo ] {
}
- Properties [1] {
- Property [ <default> public $bar ]
+ Property [ public $bar = 1 ]
}
- Dynamic properties [2] {
diff --git a/ext/reflection/tests/ReflectionObject_export_basic1.phpt b/ext/reflection/tests/ReflectionObject_export_basic1.phpt
index 43210ea686..9da648f3a2 100644
--- a/ext/reflection/tests/ReflectionObject_export_basic1.phpt
+++ b/ext/reflection/tests/ReflectionObject_export_basic1.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with no dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
@@ -25,7 +25,7 @@ Object of class [ <user> class Foo ] {
}
- Properties [1] {
- Property [ <default> public $bar ]
+ Property [ public $bar = 1 ]
}
- Dynamic properties [0] {
diff --git a/ext/reflection/tests/ReflectionObject_export_basic2.phpt b/ext/reflection/tests/ReflectionObject_export_basic2.phpt
index 970d07b432..e93dd9b331 100644
--- a/ext/reflection/tests/ReflectionObject_export_basic2.phpt
+++ b/ext/reflection/tests/ReflectionObject_export_basic2.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
$f->dynProp = 'hello';
@@ -26,7 +26,7 @@ Object of class [ <user> class Foo ] {
}
- Properties [1] {
- Property [ <default> public $bar ]
+ Property [ public $bar = 1 ]
}
- Dynamic properties [2] {
diff --git a/ext/reflection/tests/ReflectionObject_export_basic3.phpt b/ext/reflection/tests/ReflectionObject_export_basic3.phpt
index a92c2d4921..612bfa5916 100644
--- a/ext/reflection/tests/ReflectionObject_export_basic3.phpt
+++ b/ext/reflection/tests/ReflectionObject_export_basic3.phpt
@@ -3,7 +3,7 @@ ReflectionObject::__toString() - ensure dynamic property with same name as inher
--FILE--
<?php
class C {
- private $p = 1;
+ private $p = 1;
}
class D extends C{
diff --git a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt
index 7f9bc1f35c..c132f1121a 100644
--- a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt
@@ -3,24 +3,24 @@ ReflectionObject::getConstant() basic function test
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array("C", "D", "E", "F", "X");
foreach($classes as $class) {
- echo "Reflecting on instance of class $class: \n";
- $rc = new ReflectionObject(new $class);
- var_dump($rc->getConstant('a'));
- var_dump($rc->getConstant('doesntexist'));
+ echo "Reflecting on instance of class $class: \n";
+ $rc = new ReflectionObject(new $class);
+ var_dump($rc->getConstant('a'));
+ var_dump($rc->getConstant('doesNotexist'));
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt
index 0ecbde7991..f5acde8be4 100644
--- a/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt
@@ -3,23 +3,23 @@ ReflectionObject::getConstants() - basic function test
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array("C", "D", "E", "F", "X");
foreach($classes as $class) {
- echo "Reflecting on instance of class $class: \n";
- $rc = new ReflectionObject(new $class);
- var_dump($rc->getConstants());
+ echo "Reflecting on instance of class $class: \n";
+ $rc = new ReflectionObject(new $class);
+ var_dump($rc->getConstants());
}
?>
diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
index aecc9b97d2..0401ed1e0c 100644
--- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
@@ -3,81 +3,55 @@ ReflectionObject::getConstructor() - basic function test
--FILE--
<?php
class NewCtor {
- function __construct() {}
+ function __construct() {}
}
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
class X {
- function Y() {}
+ function Y() {}
}
class Y extends X {
}
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
class B {
- function B() {}
+ function B() {}
}
class C extends B {
- function C() {}
+ function C() {}
}
class D1 extends C {
- function __construct() {}
+ function __construct() {}
}
class D2 extends C {
}
-$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
- 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
+$classes = array('NewCtor', 'ExtendsNewCtor',
+ 'B', 'C', 'D1', 'D2', 'X', 'Y');
foreach ($classes as $class) {
- $rc = new ReflectionObject(new $class);
- $rm = $rc->getConstructor();
- if ($rm != null) {
- echo "Constructor of $class: " . $rm->getName() . "\n";
- } else {
- echo "No constructor for $class\n";
- }
+ $rc = new ReflectionObject(new $class);
+ $rm = $rc->getConstructor();
+ if ($rm != null) {
+ echo "Constructor of $class: " . $rm->getName() . "\n";
+ } else {
+ echo "No constructor for $class\n";
+ }
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
+--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
+No constructor for B
+No constructor for C
Constructor of D1: __construct
-Constructor of D2: C
+No constructor for D2
No constructor for X
No constructor for Y
diff --git a/ext/reflection/tests/ReflectionObject_getName_basic.phpt b/ext/reflection/tests/ReflectionObject_getName_basic.phpt
index 68cea6a1cd..1885695cb1 100644
--- a/ext/reflection/tests/ReflectionObject_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getName_basic.phpt
@@ -2,8 +2,6 @@
ReflectionObject::getName() - basic function test
--FILE--
<?php
-$r0 = new ReflectionObject();
-var_dump($r0->getName());
$r1 = new ReflectionObject(new stdClass);
var_dump($r1->getName());
@@ -18,8 +16,6 @@ var_dump($r3->getName());
?>
--EXPECTF--
-Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 2
-string(0) ""
string(8) "stdClass"
string(1) "C"
string(16) "ReflectionObject"
diff --git a/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt b/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt
index ff310df09b..146ac5ccd9 100644
--- a/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt
@@ -9,15 +9,15 @@ class X {}
$classes = array("A", "B", "X");
$instances = array( "myA" => new A,
- "myB" => new B,
- "myX" => new X );
+ "myB" => new B,
+ "myX" => new X );
foreach ($classes as $class) {
- $ro = new ReflectionObject(new $class);
- foreach ($instances as $name => $instance) {
- echo "is $name a $class? ";
- var_dump($ro->isInstance($instance));
- }
+ $ro = new ReflectionObject(new $class);
+ foreach ($instances as $name => $instance) {
+ echo "is $name a $class? ";
+ var_dump($ro->isInstance($instance));
+ }
}
?>
diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt
index 982580fc56..1b30debc9d 100644
--- a/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt
@@ -6,28 +6,28 @@ class C {
}
interface iface {
- function f1();
+ function f1();
}
class ifaceImpl implements iface {
- function f1() {}
+ function f1() {}
}
abstract class abstractClass {
- function f1() {}
- abstract function f2();
+ function f1() {}
+ abstract function f2();
}
class D extends abstractClass {
- function f2() {}
+ function f2() {}
}
$classes = array("C", "ifaceImpl", "D");
foreach($classes as $class ) {
- $ro = new ReflectionObject(new $class);
- echo "Is $class instantiable? ";
- var_dump($ro->IsInstantiable());
+ $ro = new ReflectionObject(new $class);
+ echo "Is $class instantiable? ";
+ var_dump($ro->IsInstantiable());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
index 675bbdde8d..dada6ffc78 100644
--- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
@@ -4,80 +4,47 @@ ReflectionObject::IsInstantiable() - variation - constructors
<?php
class noCtor {
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
class publicCtorNew {
- public function __construct() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ public function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
class protectedCtorNew {
- protected function __construct() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ protected function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
class privateCtorNew {
- private function __construct() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ private function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
-class publicCtorOld {
- public function publicCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-class protectedCtorOld {
- protected function protectedCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-class privateCtorOld {
- private function privateCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-
$reflectionObjects = array(
- noCtor::reflectionObjectFactory(),
- publicCtorNew::reflectionObjectFactory(),
- protectedCtorNew::reflectionObjectFactory(),
- privateCtorNew::reflectionObjectFactory(),
- publicCtorOld::reflectionObjectFactory(),
- protectedCtorOld::reflectionObjectFactory(),
- privateCtorOld::reflectionObjectFactory()
- );
+ noCtor::reflectionObjectFactory(),
+ publicCtorNew::reflectionObjectFactory(),
+ protectedCtorNew::reflectionObjectFactory(),
+ privateCtorNew::reflectionObjectFactory(),
+ );
-foreach($reflectionObjects as $reflectionObject ) {
- $name = $reflectionObject->getName();
- echo "Is $name instantiable? ";
- var_dump($reflectionObject->IsInstantiable());
+foreach ($reflectionObjects as $reflectionObject) {
+ $name = $reflectionObject->getName();
+ echo "Is $name instantiable? ";
+ var_dump($reflectionObject->IsInstantiable());
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
+--EXPECT--
Is noCtor instantiable? bool(true)
Is publicCtorNew instantiable? bool(true)
Is protectedCtorNew instantiable? bool(false)
Is privateCtorNew instantiable? bool(false)
-Is publicCtorOld instantiable? bool(true)
-Is protectedCtorOld instantiable? bool(false)
-Is privateCtorOld instantiable? bool(false)
diff --git a/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt b/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt
index 234b8eb27e..8f1c6fc841 100644
--- a/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionObject(new Exception);
$r5 = new ReflectionObject(new C);
var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(),
- $r4->isInternal(), $r5->isInternal());
+ $r4->isInternal(), $r5->isInternal());
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
index f05197ebaf..30f769aa3d 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
@@ -10,39 +10,35 @@ $ro = new ReflectionObject(new C);
echo "\n\nTest bad arguments:\n";
try {
- var_dump($ro->isSubclassOf());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($ro->isSubclassOf());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($ro->isSubclassOf('C', 'C'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf(null));
+ var_dump($ro->isSubclassOf(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf('ThisClassDoesNotExist'));
+ var_dump($ro->isSubclassOf('ThisClassDoesNotExist'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf(2));
+ var_dump($ro->isSubclassOf(2));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Test bad arguments:
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12
-NULL
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, null given
Class ThisClassDoesNotExist does not exist
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, int given
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt
index 25c29c7534..095c59fa34 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt
@@ -13,28 +13,28 @@ $classNames = array('A', 'B', 'C', 'I', 'X');
//Create ReflectionClasses
foreach ($classNames as $className) {
- $rcs[$className] = new ReflectionClass($className);
+ $rcs[$className] = new ReflectionClass($className);
}
//Create ReflectionObjects
foreach ($classNames as $className) {
- if ($rcs[$className]->isInstantiable()) {
- $ros[$className] = new ReflectionObject(new $className);
- }
+ if ($rcs[$className]->isInstantiable()) {
+ $ros[$className] = new ReflectionObject(new $className);
+ }
}
foreach ($ros as $childName => $child) {
- foreach ($rcs as $parentName => $parent) {
- echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
- echo " - Using ReflectionClass object argument: ";
- var_dump($child->isSubclassOf($parent));
- if ($parent->isInstantiable()) {
- echo " - Using ReflectionObject object argument: ";
- var_dump($child->isSubclassOf($ros[$parentName]));
- }
- echo " - Using string argument: ";
- var_dump($child->isSubclassOf($parentName));
- }
+ foreach ($rcs as $parentName => $parent) {
+ echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
+ echo " - Using ReflectionClass object argument: ";
+ var_dump($child->isSubclassOf($parent));
+ if ($parent->isInstantiable()) {
+ echo " - Using ReflectionObject object argument: ";
+ var_dump($child->isSubclassOf($ros[$parentName]));
+ }
+ echo " - Using string argument: ";
+ var_dump($child->isSubclassOf($parentName));
+ }
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
index 11994ed705..582bcffe65 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
@@ -5,20 +5,12 @@ ReflectionObject::isSubclassOf() - invalid params
class A {}
$ro = new ReflectionObject(new A);
-var_dump($ro->isSubclassOf());
-var_dump($ro->isSubclassOf('A',5));
var_dump($ro->isSubclassOf('X'));
?>
--EXPECTF--
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6
-NULL
-
-Fatal error: Uncaught ReflectionException: Class X does not exist in %s:7
+Fatal error: Uncaught ReflectionException: Class X does not exist in %s:%d
Stack trace:
-#0 %s(7): ReflectionClass->isSubclassOf('X')
+#0 %s(%d): ReflectionClass->isSubclassOf('X')
#1 {main}
- thrown in %s on line 7
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt b/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt
index 1a9dea3aba..f561b909e4 100644
--- a/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionObject(new Exception);
$r5 = new ReflectionObject(new C);
var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(),
- $r4->isUserDefined(), $r5->isUserDefined());
+ $r4->isUserDefined(), $r5->isUserDefined());
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionParameter_001.phpt b/ext/reflection/tests/ReflectionParameter_001.phpt
index 822da2fe9a..b2b5218724 100644
--- a/ext/reflection/tests/ReflectionParameter_001.phpt
+++ b/ext/reflection/tests/ReflectionParameter_001.phpt
@@ -11,11 +11,11 @@ class ReflectTestClass {
}
public function oneArgNonStatic($theParam) {
- $theParam--;
+ $theParam--;
}
public function noArgs() {
- echo "No arg function\n";
+ echo "No arg function\n";
}
}
@@ -25,18 +25,18 @@ $method = new ReflectionMethod('ReflectTestClass', 'twoArgFunction');
$parameters = $method->getParameters();
echo "Parameters from twoArgMethod:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
- $name = $parameter->getName();
- echo "\n";
+ var_dump($parameter);
+ $name = $parameter->getName();
+ echo "\n";
}
$method = new ReflectionMethod('ReflectTestClass', 'oneArgNonStatic');
$parameters = $method->getParameters();
echo "Parameters from oneArgNonStatic:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
- $name = $parameter->getName();
- echo "\n";
+ var_dump($parameter);
+ $name = $parameter->getName();
+ echo "\n";
}
@@ -45,9 +45,9 @@ $parameters = $method->getParameters();
echo "Parameters from noArgs:\n\n";
var_dump($parameters);
foreach($parameters as $parameter) {
- var_dump($parameter);
- $name = $parameter->getName();
- echo "\n";
+ var_dump($parameter);
+ $name = $parameter->getName();
+ echo "\n";
}
echo "done\n";
diff --git a/ext/reflection/tests/ReflectionParameter_002.phpt b/ext/reflection/tests/ReflectionParameter_002.phpt
index 571edac7a9..7ff12c2d33 100644
--- a/ext/reflection/tests/ReflectionParameter_002.phpt
+++ b/ext/reflection/tests/ReflectionParameter_002.phpt
@@ -21,11 +21,11 @@ $method = new ReflectionMethod('ReflectTestClass', 'staticMethod');
$parameters = $method->getParameters();
echo "Parameters from staticMethod:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
+ var_dump($parameter);
if($parameter->isPassedByReference()) {
- echo "This param is passed by reference\n";
+ echo "This param is passed by reference\n";
} else {
- echo "This param is not passed by reference\n";
+ echo "This param is not passed by reference\n";
}
echo "\n";
}
@@ -36,11 +36,11 @@ $method = new ReflectionMethod('ReflectTestClass', 'instanceMethod');
$parameters = $method->getParameters();
echo "Parameters from instanceMethod:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
+ var_dump($parameter);
if($parameter->isPassedByReference()) {
- echo "This param is passed by reference\n";
+ echo "This param is passed by reference\n";
} else {
- echo "This param is not passed by reference\n";
+ echo "This param is not passed by reference\n";
}
echo "\n";
}
diff --git a/ext/reflection/tests/ReflectionParameter_003.phpt b/ext/reflection/tests/ReflectionParameter_003.phpt
index cc092bffcc..16a422caa4 100644
--- a/ext/reflection/tests/ReflectionParameter_003.phpt
+++ b/ext/reflection/tests/ReflectionParameter_003.phpt
@@ -24,31 +24,31 @@ $refParameters = $refMethod->getParameters();
echo "parameter names from staticMethod method:\n\n";
foreach($refParameters as $parameter) {
- var_dump($parameter);
- if($parameter->isOptional()) {
- echo "this parameter is optional\n";
- } else {
- echo "this parameter is not optional\n";
- }
+ var_dump($parameter);
+ if($parameter->isOptional()) {
+ echo "this parameter is optional\n";
+ } else {
+ echo "this parameter is not optional\n";
+ }
- if($parameter->isDefaultValueAvailable()) {
- echo "this parameter has a default value\n";
- } else {
- echo "this parameter has no default value\n";
- }
+ if($parameter->isDefaultValueAvailable()) {
+ echo "this parameter has a default value\n";
+ } else {
+ echo "this parameter has no default value\n";
+ }
- /*
- $val = 0;
- try {
- $val = $parameter->getDefaultValue();
- var_dump($val);
- } catch (ReflectionException $e) {
- print $e->getMessage();
- echo "\n";
- }
- */
+ /*
+ $val = 0;
+ try {
+ $val = $parameter->getDefaultValue();
+ var_dump($val);
+ } catch (ReflectionException $e) {
+ print $e->getMessage();
+ echo "\n";
+ }
+ */
- echo "\n";
+ echo "\n";
}
?>
@@ -56,7 +56,7 @@ foreach($refParameters as $parameter) {
hello from test
third is jack
-Notice: Undefined variable: theIncrement in %s on line 8
+Warning: Undefined variable $theIncrement in %s on line %d
parameter names from staticMethod method:
object(ReflectionParameter)#%d (1) {
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
index 20f4c95dc7..98fcf5afac 100644
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
@@ -6,42 +6,41 @@ ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName()
define("CONST_TEST_1", "const1");
function ReflectionParameterTest($test1=array(), $test2 = CONST_TEST_1, $test3 = CASE_LOWER) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $param) {
- if($param->getName() == 'test1') {
- var_dump($param->isDefaultValueConstant());
- }
- if($param->getName() == 'test2') {
- var_dump($param->isDefaultValueConstant());
- }
- if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
- var_dump($param->getDefaultValueConstantName());
- }
+ if($param->getName() == 'test1') {
+ var_dump(@$param->isDefaultValueConstant());
+ }
+ if($param->getName() == 'test2') {
+ var_dump(@$param->isDefaultValueConstant());
+ }
+ if($param->isDefaultValueAvailable() && @$param->isDefaultValueConstant()) {
+ var_dump(@$param->getDefaultValueConstantName());
+ }
}
class Foo2 {
- const bar = 'Foo2::bar';
+ const bar = 'Foo2::bar';
}
class Foo {
- const bar = 'Foo::bar';
+ const bar = 'Foo::bar';
- public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) {
- }
+ public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) {
+ }
}
$method = new ReflectionMethod('Foo', 'baz');
$params = $method->getParameters();
foreach ($params as $param) {
- if ($param->isDefaultValueConstant()) {
- var_dump($param->getDefaultValueConstantName());
+ if (@$param->isDefaultValueConstant()) {
+ var_dump(@$param->getDefaultValueConstantName());
}
}
?>
-==DONE==
--EXPECT--
bool(false)
bool(true)
@@ -50,4 +49,3 @@ string(10) "CASE_LOWER"
string(9) "self::bar"
string(9) "Foo2::bar"
string(12) "CONST_TEST_1"
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
index 1ee9e93735..e3d3b9dd96 100644
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
@@ -4,27 +4,25 @@ ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() f
<?php
namespace ReflectionTestNamespace {
- CONST TEST_CONST_1 = "Test Const 1";
+ CONST TEST_CONST_1 = "Test Const 1";
- class TestClass {
- const TEST_CONST_2 = "Test Const 2 in class";
- }
+ class TestClass {
+ const TEST_CONST_2 = "Test Const 2 in class";
+ }
}
namespace {
- function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
- echo $test;
- }
- $reflect = new ReflectionFunction('ReflectionParameterTest');
- foreach($reflect->getParameters() as $param) {
- if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
- echo $param->getDefaultValueConstantName() . "\n";
- }
- }
- echo "==DONE==";
+ function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
+ echo $test;
+ }
+ $reflect = new ReflectionFunction('ReflectionParameterTest');
+ foreach($reflect->getParameters() as $param) {
+ if($param->isDefaultValueAvailable() && @$param->isDefaultValueConstant()) {
+ echo @$param->getDefaultValueConstantName() . "\n";
+ }
+ }
}
?>
--EXPECT--
ReflectionTestNamespace\TestClass::TEST_CONST_2
ReflectionTestNamespace\CONST_TEST_1
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
index a2c2d24582..9555152404 100644
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
@@ -6,16 +6,15 @@ ReflectionParameter::getDefaultValueConstant() should raise exception on non opt
define("CONST_TEST_1", "const1");
function ReflectionParameterTest($test, $test2 = CONST_TEST_1) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $param) {
- try {
- echo $param->getDefaultValueConstantName() . "\n";
- }
- catch(ReflectionException $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ echo $param->getDefaultValueConstantName() . "\n";
+ } catch(ReflectionException $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionParameter_export_basic.phpt b/ext/reflection/tests/ReflectionParameter_export_basic.phpt
index 6f3d16a5ff..68a43610ef 100644
--- a/ext/reflection/tests/ReflectionParameter_export_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_export_basic.phpt
@@ -5,15 +5,13 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $key => $value) {
- echo new ReflectionParameter('ReflectionParameterTest', $key), "\n";
+ echo new ReflectionParameter('ReflectionParameterTest', $key), "\n";
}
?>
-==DONE==
---EXPECTF--
+--EXPECT--
Parameter #0 [ <required> $test ]
Parameter #1 [ <optional> $test2 = NULL ]
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_export_error2.phpt b/ext/reflection/tests/ReflectionParameter_export_error2.phpt
deleted file mode 100644
index 38cd99171b..0000000000
--- a/ext/reflection/tests/ReflectionParameter_export_error2.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-ReflectionParameter::export() with incorrect first parameter
---CREDITS--
-Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
---FILE--
-<?php
-function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
-}
-$reflect = new ReflectionFunction('ReflectionParameterTest');
-$params = $reflect->getParameters();
-try {
- foreach($params as $key => $value) {
- ReflectionParameter::export($reflect, $key);
- }
-}
-catch (ReflectionException $e) {
- echo $e->getMessage() . "\n";
-}
-try {
- foreach($params as $key => $value) {
- ReflectionParameter::export(42, $key);
- }
-}
-catch (ReflectionException $e) {
- echo $e->getMessage() . "\n";
-}
-?>
---EXPECTF--
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-Method ReflectionFunction::__invoke() does not exist
-
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-The parameter class is expected to be either a string, an array(class, method) or a callable object
diff --git a/ext/reflection/tests/ReflectionParameter_export_error3.phpt b/ext/reflection/tests/ReflectionParameter_export_error3.phpt
deleted file mode 100644
index b098a9251d..0000000000
--- a/ext/reflection/tests/ReflectionParameter_export_error3.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ReflectionParameter::export() with incorrect second parameter
---CREDITS--
-Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
---FILE--
-<?php
-function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
-}
-$reflect = new ReflectionFunction('ReflectionParameterTest');
-$params = $reflect->getParameters();
-foreach($params as $key => $value) {
- ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter');
-}
---EXPECTF--
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-
-Fatal error: Uncaught ReflectionException: The parameter specified by its name could not be found in %s:%d
-Stack trace:
-#0 [internal function]: ReflectionParameter->__construct('ReflectionParam...', 'incorrect_param...')
-#1 %s(%d): ReflectionParameter::export('ReflectionParam...', 'incorrect_param...')
-#2 {main}
- thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt
index 59e15a7054..dee0196880 100644
--- a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt
@@ -6,15 +6,14 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- echo $value->getDeclaringFunction() . "\n";
+ echo $value->getDeclaringFunction() . "\n";
}
?>
-==DONE==
--EXPECTF--
Function [ <user> function ReflectionParameterTest ] {
@@ %s.php %d - %d
@@ -33,5 +32,3 @@ Function [ <user> function ReflectionParameterTest ] {
Parameter #1 [ <optional> $test2 = NULL ]
}
}
-
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt
index 2807bdf66d..485ca37a2b 100644
--- a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt
@@ -6,16 +6,14 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- var_dump($value->getPosition());
+ var_dump($value->getPosition());
}
?>
-==DONE==
--EXPECT--
int(0)
int(1)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt
index eb6d4644a0..fd83e30aaa 100644
--- a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt
+++ b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt
@@ -5,17 +5,17 @@ ReflectionParameter::__construct(): Invalid method as constructor
// Invalid class name
try {
- new ReflectionParameter (array ('A', 'b'), 0);
+ new ReflectionParameter (array ('A', 'b'), 0);
} catch (ReflectionException $e) { echo $e->getMessage()."\n"; }
// Invalid class method
try {
- new ReflectionParameter (array ('C', 'b'), 0);
+ new ReflectionParameter (array ('C', 'b'), 0);
} catch (ReflectionException $e) { echo $e->getMessage ()."\n"; }
// Invalid object method
try {
- new ReflectionParameter (array (new C, 'b'), 0);
+ new ReflectionParameter (array (new C, 'b'), 0);
} catch (ReflectionException $e) { echo $e->getMessage ()."\n"; }
@@ -23,17 +23,17 @@ class C {
}
try {
- new ReflectionParameter(array ('A', 'b'));
+ new ReflectionParameter(array ('A', 'b'));
}
catch(TypeError $e) {
- printf( "Ok - %s\n", $e->getMessage());
+ printf( "Ok - %s\n", $e->getMessage());
}
try {
- new ReflectionParameter(0, 0);
+ new ReflectionParameter(0, 0);
}
catch(ReflectionException $e) {
- printf( "Ok - %s\n", $e->getMessage());
+ printf( "Ok - %s\n", $e->getMessage());
}
echo "Done.\n";
@@ -44,5 +44,5 @@ Class A does not exist
Method C::b() does not exist
Method C::b() does not exist
Ok - ReflectionParameter::__construct() expects exactly 2 parameters, 1 given
-Ok - The parameter class is expected to be either a string, an array(class, method) or a callable object
+Ok - ReflectionParameter::__construct(): Argument #1 ($function) must be either a string, an array(class, method) or a callable object, int given
Done.
diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt
index d8b4f0edc0..ea95878170 100644
--- a/ext/reflection/tests/ReflectionParameter_isDefault.phpt
+++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt
@@ -23,7 +23,6 @@ $prop2 = new ReflectionProperty($a, 'myprop');
var_dump($prop1->isDefault());
var_dump($prop2->isDefault());
?>
-==DONE==
--EXPECT--
bool(true)
bool(false)
@@ -31,4 +30,3 @@ bool(true)
bool(false)
bool(true)
bool(false)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt
index d1a23c758d..053c3918db 100644
--- a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt
@@ -5,17 +5,15 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null, ...$test3) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- echo $value->__toString() . "\n";
+ echo $value->__toString() . "\n";
}
?>
-==DONE==
--EXPECT--
Parameter #0 [ <required> $test ]
Parameter #1 [ <optional> $test2 = NULL ]
Parameter #2 [ <optional> ...$test3 ]
-==DONE==
diff --git a/ext/reflection/tests/ReflectionProperty_basic1.phpt b/ext/reflection/tests/ReflectionProperty_basic1.phpt
index 1748ebfca9..cef672ecde 100644
--- a/ext/reflection/tests/ReflectionProperty_basic1.phpt
+++ b/ext/reflection/tests/ReflectionProperty_basic1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test usage of ReflectionProperty methods __toString(), export(), getName(), isPublic(), isPrivate(), isProtected(), isStatic(), getValue() and setValue().
+Test usage of ReflectionProperty methods __toString(), getName(), isPublic(), isPrivate(), isProtected(), isStatic(), getValue() and setValue().
--FILE--
<?php
@@ -9,10 +9,6 @@ function reflectProperty($class, $property) {
echo "Reflecting on property $class::$property\n\n";
echo "__toString():\n";
var_dump($propInfo->__toString());
- echo "export():\n";
- var_dump(ReflectionProperty::export($class, $property, true));
- echo "export():\n";
- var_dump(ReflectionProperty::export($class, $property, false));
echo "getName():\n";
var_dump($propInfo->getName());
echo "isPublic():\n";
@@ -47,24 +43,13 @@ reflectProperty("TestClass", "prot");
reflectProperty("TestClass", "priv");
?>
---EXPECTF--
+--EXPECT--
**********************************
Reflecting on property TestClass::pub
__toString():
-string(35) "Property [ <default> public $pub ]
+string(32) "Property [ public $pub = NULL ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(35) "Property [ <default> public $pub ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ <default> public $pub ]
-
-NULL
getName():
string(3) "pub"
isPublic():
@@ -85,19 +70,8 @@ string(8) "NewValue"
Reflecting on property TestClass::stat
__toString():
-string(33) "Property [ public static $stat ]
+string(53) "Property [ public static $stat = 'static property' ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(33) "Property [ public static $stat ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ public static $stat ]
-
-NULL
getName():
string(4) "stat"
isPublic():
@@ -118,19 +92,8 @@ string(8) "NewValue"
Reflecting on property TestClass::prot
__toString():
-string(39) "Property [ <default> protected $prot ]
+string(33) "Property [ protected $prot = 4 ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(39) "Property [ <default> protected $prot ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ <default> protected $prot ]
-
-NULL
getName():
string(4) "prot"
isPublic():
@@ -147,19 +110,8 @@ bool(false)
Reflecting on property TestClass::priv
__toString():
-string(37) "Property [ <default> private $priv ]
+string(39) "Property [ private $priv = 'keepOut' ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(37) "Property [ <default> private $priv ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ <default> private $priv ]
-
-NULL
getName():
string(4) "priv"
isPublic():
diff --git a/ext/reflection/tests/ReflectionProperty_constructor_error.phpt b/ext/reflection/tests/ReflectionProperty_constructor_error.phpt
index 38a34681db..a2df954309 100644
--- a/ext/reflection/tests/ReflectionProperty_constructor_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_constructor_error.phpt
@@ -38,7 +38,7 @@ Non-existent class:
Class NonExistentClass does not exist
Wrong property parameter type:
-The parameter class is expected to be either a string or an object
+ReflectionProperty::__construct(): Argument #1 ($class) must be of type object|string, int given
Non-existent property:
Property TestClass::$nonExistentProperty does not exist
diff --git a/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt b/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt
index 6f39f9db6c..4456960dc7 100644
--- a/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt
+++ b/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt
@@ -4,27 +4,27 @@ ReflectionProperty::__construct(): ensure inherited private props can't be acces
<?php
class C {
- private $p = 1;
-
- static function testFromC() {
- try {
- $rp = new ReflectionProperty("D", "p");
- var_dump($rp);
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- }
+ private $p = 1;
+
+ static function testFromC() {
+ try {
+ $rp = new ReflectionProperty("D", "p");
+ var_dump($rp);
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+ }
}
class D extends C{
- static function testFromD() {
- try {
- $rp = new ReflectionProperty("D", "p");
- var_dump($rp);
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- }
+ static function testFromD() {
+ try {
+ $rp = new ReflectionProperty("D", "p");
+ var_dump($rp);
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+ }
}
echo "--> Reflect inherited private from global scope:\n";
@@ -32,7 +32,7 @@ try {
$rp = new ReflectionProperty("D", "p");
var_dump($rp);
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
echo "\n\n--> Reflect inherited private from declaring scope:\n";
diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt
index c8a2f11ee1..052bfcb97c 100644
--- a/ext/reflection/tests/ReflectionProperty_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_error.phpt
@@ -8,55 +8,24 @@ class C {
}
try {
- new ReflectionProperty();
+ new ReflectionProperty();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- new ReflectionProperty('C::p');
+ new ReflectionProperty('C::p');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- new ReflectionProperty('C', 'p', 'x');
+ new ReflectionProperty('C', 'p', 'x');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
-
-$rp = new ReflectionProperty('C', 'p');
-var_dump($rp->getName(1));
-var_dump($rp->isPrivate(1));
-var_dump($rp->isProtected(1));
-var_dump($rp->isPublic(1));
-var_dump($rp->isStatic(1));
-var_dump($rp->getModifiers(1));
-var_dump($rp->isDefault(1));
-
?>
---EXPECTF--
+--EXPECT--
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 0 given
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 1 given
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 3 given
-
-Warning: ReflectionProperty::getName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionProperty_export_basic.phpt b/ext/reflection/tests/ReflectionProperty_export_basic.phpt
deleted file mode 100644
index 28f1f6b988..0000000000
--- a/ext/reflection/tests/ReflectionProperty_export_basic.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Test ReflectionProperty::__toString() usage.
---FILE--
-<?php
-
-class TestClass {
- public $proper = 5;
-}
-
-echo new ReflectionProperty('TestClass', 'proper');
-
-?>
---EXPECT--
-Property [ <default> public $proper ]
diff --git a/ext/reflection/tests/ReflectionProperty_export_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt
deleted file mode 100644
index 114b4c0ac8..0000000000
--- a/ext/reflection/tests/ReflectionProperty_export_error.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-Test ReflectionProperty::export() errors.
---FILE--
-<?php
-
-class TestClass {
-}
-
-$a = 5;
-
-echo "Non-existent class:\n";
-try {
- ReflectionProperty::export("NonExistentClass", "prop", true);
-}
-catch(Exception $e) {
- echo $e->getMessage();
-}
-
-echo "\n\nWrong property parameter type:\n";
-try {
- ReflectionProperty::export($a, 'TestClass', false);
-}
-catch(ReflectionException $e) {
- echo $e->getMessage();
-}
-
-echo "\n\nNon-existent property:\n";
-try {
- ReflectionProperty::export('TestClass', "nonExistentProperty", true);
-}
-catch(Exception $e) {
- echo $e->getMessage();
-}
-
-echo "\n\nIncorrect number of args:\n";
-ReflectionProperty::export();
-ReflectionProperty::export('TestClass', "nonExistentProperty", true, false);
-
-?>
---EXPECTF--
-Non-existent class:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Class NonExistentClass does not exist
-
-Wrong property parameter type:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-The parameter class is expected to be either a string or an object
-
-Non-existent property:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property TestClass::$nonExistentProperty does not exist
-
-Incorrect number of args:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-
-Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-
-Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
index c7c9366471..7ee787a348 100644
--- a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
@@ -13,15 +13,9 @@ class B extends A {
$propInfo = new ReflectionProperty('B', 'prop');
var_dump($propInfo->getDeclaringClass());
-echo "Wrong number of params:\n";
-$propInfo->getDeclaringClass(1);
-
?>
--EXPECTF--
object(ReflectionClass)#%d (1) {
["name"]=>
string(1) "A"
}
-Wrong number of params:
-
-Warning: ReflectionProperty::getDeclaringClass() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt b/ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt
new file mode 100644
index 0000000000..26614f5c60
--- /dev/null
+++ b/ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt
@@ -0,0 +1,73 @@
+--TEST--
+reflection: ReflectionProperty::getDefaultValue
+--FILE--
+<?php
+
+define('FOO', 42);
+
+class TestClass
+{
+ public $foo;
+ public $bar = 'baz';
+
+ public static $static1;
+ public static $static2 = 1234;
+
+ public int $val1;
+ public int $val2 = 1234;
+
+ public ?int $nullable;
+ public ?int $nullable2 = null;
+
+ public $constantAst = 2 * 2;
+ public $constantRuntimeAst = FOO;
+}
+
+$property = new ReflectionProperty(TestClass::class, 'foo');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'bar');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static1');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static2');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val1');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val2');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable2');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'constantAst');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'constantRuntimeAst');
+var_dump($property->getDefaultValue());
+
+$test = new TestClass;
+$test->dynamic = null;
+$property = new ReflectionProperty($test, 'dynamic');
+var_dump($property->getDefaultValue());
+
+?>
+--EXPECT--
+NULL
+string(3) "baz"
+NULL
+int(1234)
+NULL
+int(1234)
+NULL
+NULL
+int(4)
+int(42)
+NULL
diff --git a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
index a297a10436..da6cf71b9c 100644
--- a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
@@ -7,15 +7,15 @@ Steve Seear <stevseea@php.net>
<?php
function reflectProperty($class, $property) {
- $propInfo = new ReflectionProperty($class, $property);
+ $propInfo = new ReflectionProperty($class, $property);
- echo "**********************************\n";
- echo "Reflecting on property $class::$property\n\n";
+ echo "**********************************\n";
+ echo "Reflecting on property $class::$property\n\n";
- echo "getModifiers():\n";
- var_dump($propInfo->getModifiers());
+ echo "getModifiers():\n";
+ var_dump($propInfo->getModifiers());
- echo "\n**********************************\n";
+ echo "\n**********************************\n";
}
class TestClass
@@ -23,8 +23,8 @@ class TestClass
public $pub;
static public $stat = "static property";
/**
- * This property has a comment.
- */
+ * This property has a comment.
+ */
protected $prot = 4;
private $priv = "keepOut";
}
diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
index 3bca85e4b6..c5da067c32 100644
--- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
@@ -18,23 +18,15 @@ $instance = new TestClass();
$invalidInstance = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-echo "Too few args:\n";
-var_dump($propInfo->getValue());
-
-echo "\nToo many args:\n";
-var_dump($propInfo->getValue($instance, true));
-
-echo "\nWrong type of arg:\n";
-var_dump($propInfo->getValue(true));
-
echo "\nInstance without property:\n";
$propInfo = new ReflectionProperty('TestClass', 'stat');
echo "\nStatic property / too many args:\n";
-var_dump($propInfo->getValue($instance, true));
-
-echo "\nStatic property / wrong type of arg:\n";
-var_dump($propInfo->getValue(true));
+try {
+ var_dump($propInfo->getValue($instance, true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\nProtected property:\n";
try {
@@ -47,40 +39,31 @@ catch(Exception $exc) {
echo "\n\nInvalid instance:\n";
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-var_dump($propInfo->getValue($invalidInstance));
-
-?>
---EXPECTF--
-Too few args:
-
-Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Too many args:
-
-Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Wrong type of arg:
+try {
+ var_dump($propInfo->getValue($invalidInstance));
+} catch (ReflectionException $e) {
+ echo $e->getMessage();
+}
-Warning: ReflectionProperty::getValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
+echo "\n\nMissing instance:\n";
+try {
+ var_dump($propInfo->getValue());
+} catch (TypeError $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
Instance without property:
Static property / too many args:
-string(15) "static property"
-
-Static property / wrong type of arg:
-string(15) "static property"
+ReflectionProperty::getValue() expects at most 1 parameter, 2 given
Protected property:
Cannot access non-public member TestClass::$prot
Invalid instance:
+Given object is not an instance of the class this property was declared in
-Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:47
-Stack trace:
-#0 %s(47): ReflectionProperty->getValue(Object(AnotherClass))
-#1 {main}
- thrown in %s on line 47
+Missing instance:
+No object provided for getValue() on instance property
diff --git a/ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt b/ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt
new file mode 100644
index 0000000000..5709000370
--- /dev/null
+++ b/ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt
@@ -0,0 +1,60 @@
+--TEST--
+reflection: ReflectionProperty::hasDefaultValue
+--FILE--
+<?php
+
+class TestClass
+{
+ public $foo;
+ public $bar = 'baz';
+
+ public static $static1;
+ public static $static2 = 1234;
+
+ public int $val1;
+ public int $val2 = 1234;
+
+ public ?int $nullable;
+ public ?int $nullable2 = null;
+}
+
+$property = new ReflectionProperty(TestClass::class, 'foo');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'bar');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static1');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static2');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val1');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val2');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable2');
+var_dump($property->hasDefaultValue());
+
+$test = new TestClass;
+$test->dynamic = null;
+$property = new ReflectionProperty($test, 'dynamic');
+var_dump($property->hasDefaultValue());
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
diff --git a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
index 2aa630d9d0..1472615178 100644
--- a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
+++ b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
@@ -24,10 +24,6 @@ reflectProperty("TestClass", "stat");
reflectProperty("TestClass", "prot");
reflectProperty("TestClass", "priv");
-echo "Wrong number of params:\n";
-$propInfo = new ReflectionProperty('TestClass', 'pub');
-$propInfo->isDefault(1);
-
?>
--EXPECTF--
**********************************
@@ -58,6 +54,3 @@ isDefault():
bool(true)
**********************************
-Wrong number of params:
-
-Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
index f1f6e53ebd..29541e405b 100644
--- a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
+++ b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
@@ -4,12 +4,12 @@ Test ReflectionProperty::isInitialized()
<?php
class A {
- public static ?string $ssv = null;
- public static ?string $ss;
- public static $s;
- public ?int $iv = null;
- public ?int $i;
- public $n;
+ public static ?string $ssv = null;
+ public static ?string $ss;
+ public static $s;
+ public ?int $iv = null;
+ public ?int $i;
+ public $n;
private int $p;
}
@@ -62,6 +62,12 @@ try {
echo $e->getMessage(), "\n";
}
+try {
+ var_dump($rp->isInitialized());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
class WithMagic {
public $prop;
public int $intProp;
@@ -108,6 +114,7 @@ bool(false)
Object type:
bool(false)
Given object is not an instance of the class this property was declared in
+No object provided for isInitialized() on instance property
Class with __isset:
bool(false)
bool(false)
diff --git a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
index 0bf223daa7..f58590b3ea 100644
--- a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
@@ -18,30 +18,6 @@ $instance = new TestClass();
$instanceWithNoProperties = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-echo "Too few args:\n";
-var_dump($propInfo->setValue());
-var_dump($propInfo->setValue($instance));
-
-echo "\nToo many args:\n";
-var_dump($propInfo->setValue($instance, "NewValue", true));
-
-echo "\nWrong type of arg:\n";
-var_dump($propInfo->setValue(true, "NewValue"));
-$propInfo = new ReflectionProperty('TestClass', 'stat');
-
-echo "\nStatic property / too many args:\n";
-var_dump($propInfo->setValue($instance, "NewValue", true));
-
-echo "\nStatic property / too few args:\n";
-var_dump($propInfo->setValue("A new value"));
-var_dump(TestClass::$stat);
-var_dump($propInfo->setValue());
-var_dump(TestClass::$stat);
-
-echo "\nStatic property / wrong type of arg:\n";
-var_dump($propInfo->setValue(true, "Another new value"));
-var_dump(TestClass::$stat);
-
echo "\nProtected property:\n";
try {
$propInfo = new ReflectionProperty('TestClass', 'prot');
@@ -57,41 +33,6 @@ var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue"));
var_dump($instanceWithNoProperties->pub2);
?>
--EXPECTF--
-Too few args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Too many args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Wrong type of arg:
-
-Warning: ReflectionProperty::setValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
-Static property / too many args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Static property / too few args:
-NULL
-string(11) "A new value"
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-string(11) "A new value"
-
-Static property / wrong type of arg:
-NULL
-string(17) "Another new value"
-
Protected property:
Cannot access non-public member TestClass::$prot
diff --git a/ext/reflection/tests/ReflectionProperty_typed_static.phpt b/ext/reflection/tests/ReflectionProperty_typed_static.phpt
index 77f95d77ef..eaf4209644 100644
--- a/ext/reflection/tests/ReflectionProperty_typed_static.phpt
+++ b/ext/reflection/tests/ReflectionProperty_typed_static.phpt
@@ -45,7 +45,7 @@ var_dump($rp->getValue());
int(42)
Typed static property Test::$y must not be accessed before initialization
int(24)
-Typed property Test::$y must be int, string used
+Cannot assign string to property Test::$y of type int
int(24)
Cannot assign string to reference held by property Test::$y of type int
int(24)
diff --git a/ext/reflection/tests/ReflectionReference_errors.phpt b/ext/reflection/tests/ReflectionReference_errors.phpt
index 8e52a1d223..88244b7940 100644
--- a/ext/reflection/tests/ReflectionReference_errors.phpt
+++ b/ext/reflection/tests/ReflectionReference_errors.phpt
@@ -41,8 +41,8 @@ var_dump(unserialize('O:19:"ReflectionReference":0:{}'));
?>
--EXPECTF--
Call to private ReflectionReference::__construct() from invalid context
-ReflectionReference::fromArrayElement() expects parameter 1 to be array, object given
-Key must be array or string
+ReflectionReference::fromArrayElement(): Argument #1 ($array) must be of type array, object given
+ReflectionReference::fromArrayElement(): Argument #2 ($key) must be of type string|int, float given
Array key not found
Serialization of 'ReflectionReference' is not allowed
diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt
index 1eb521317c..d0f327d046 100644
--- a/ext/reflection/tests/ReflectionType_001.phpt
+++ b/ext/reflection/tests/ReflectionType_001.phpt
@@ -2,7 +2,7 @@
ReflectionParameter::get/hasType and ReflectionType tests
--FILE--
<?php
-function foo(stdClass $a, array $b, callable $c, stdClass $d = null, $e = null, string $f, bool $g, int $h, float $i, NotExisting $j) { }
+function foo(stdClass $a, array $b, callable $c, string $f, bool $g, int $h, float $i, NotExisting $j, stdClass $d = null, $e = null) { }
function bar(): stdClass { return new stdClass; }
@@ -77,22 +77,22 @@ foreach ([
echo "\n*** property types\n";
class PropTypeTest {
- public int $int;
- public string $string;
- public array $arr;
- public iterable $iterable;
- public stdClass $std;
- public OtherThing $other;
- public $mixed;
+ public int $int;
+ public string $string;
+ public array $arr;
+ public iterable $iterable;
+ public stdClass $std;
+ public OtherThing $other;
+ public $mixed;
}
$reflector = new ReflectionClass(PropTypeTest::class);
foreach ($reflector->getProperties() as $name => $property) {
- if ($property->hasType()) {
- printf("public %s $%s;\n",
- $property->getType()->getName(), $property->getName());
- } else printf("public $%s;\n", $property->getName());
+ if ($property->hasType()) {
+ printf("public %s $%s;\n",
+ $property->getType()->getName(), $property->getName());
+ } else printf("public $%s;\n", $property->getName());
}
echo "*** resolved property types\n";
@@ -120,36 +120,36 @@ bool(true)
string(8) "callable"
** Function 0 - Parameter 3
bool(true)
-bool(true)
-bool(false)
-string(8) "stdClass"
-** Function 0 - Parameter 4
-bool(false)
-** Function 0 - Parameter 5
-bool(true)
bool(false)
bool(true)
string(6) "string"
-** Function 0 - Parameter 6
+** Function 0 - Parameter 4
bool(true)
bool(false)
bool(true)
string(4) "bool"
-** Function 0 - Parameter 7
+** Function 0 - Parameter 5
bool(true)
bool(false)
bool(true)
string(3) "int"
-** Function 0 - Parameter 8
+** Function 0 - Parameter 6
bool(true)
bool(false)
bool(true)
string(5) "float"
-** Function 0 - Parameter 9
+** Function 0 - Parameter 7
bool(true)
bool(false)
bool(false)
string(11) "NotExisting"
+** Function 0 - Parameter 8
+bool(true)
+bool(true)
+bool(false)
+string(8) "stdClass"
+** Function 0 - Parameter 9
+bool(false)
** Function 1 - Parameter 0
bool(true)
bool(false)
diff --git a/ext/reflection/tests/ReflectionZendExtension.phpt b/ext/reflection/tests/ReflectionZendExtension.phpt
index bce34f5a2c..0c5a8e6121 100644
--- a/ext/reflection/tests/ReflectionZendExtension.phpt
+++ b/ext/reflection/tests/ReflectionZendExtension.phpt
@@ -12,7 +12,6 @@ var_dump($reflection->getCopyright());
var_dump($reflection->getName());
var_dump($reflection->getURL());
var_dump($reflection->getVersion() === PHP_VERSION);
-var_dump(gettype($reflection->export('Zend OPcache', true)) === 'string');
?>
--EXPECTF--
string(17) "Zend Technologies"
@@ -20,6 +19,3 @@ string(13) "Copyright (c)"
string(12) "Zend OPcache"
string(20) "http://www.zend.com/"
bool(true)
-
-Deprecated: Function ReflectionZendExtension::export() is deprecated in %s on line %d
-bool(true)
diff --git a/ext/reflection/tests/ReflectionZendExtension_error.phpt b/ext/reflection/tests/ReflectionZendExtension_error.phpt
index efce02640b..cd06b96465 100644
--- a/ext/reflection/tests/ReflectionZendExtension_error.phpt
+++ b/ext/reflection/tests/ReflectionZendExtension_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test ReflectionZendExtension class erros
+Test ReflectionZendExtension class errors
--CREDITS--
Gabriel Caruso (carusogabriel34@gmail.com)
--SKIPIF--
diff --git a/ext/reflection/tests/bug26640.phpt b/ext/reflection/tests/bug26640.phpt
index 8a93d72247..203785f1dc 100644
--- a/ext/reflection/tests/bug26640.phpt
+++ b/ext/reflection/tests/bug26640.phpt
@@ -4,19 +4,19 @@ Reflection Bug #26640 (__autoload() not invoked by Reflection classes)
<?php
spl_autoload_register(function ($c) {
- class autoload_class
- {
- public function __construct()
- {
- print "autoload success\n";
- }
- }
+ class autoload_class
+ {
+ public function __construct()
+ {
+ print "autoload success\n";
+ }
+ }
});
$a = new ReflectionClass('autoload_class');
if (is_object($a)) {
- echo "OK\n";
+ echo "OK\n";
}
?>
diff --git a/ext/reflection/tests/bug26695.phpt b/ext/reflection/tests/bug26695.phpt
index e429f766e9..ab61ee929f 100644
--- a/ext/reflection/tests/bug26695.phpt
+++ b/ext/reflection/tests/bug26695.phpt
@@ -19,7 +19,5 @@ $class = $params[0]->getClass();
var_dump($class->getName());
?>
-===DONE===
--EXPECT--
string(3) "Foo"
-===DONE===
diff --git a/ext/reflection/tests/bug29268.phpt b/ext/reflection/tests/bug29268.phpt
index 9166bd3aa9..596d3aba1e 100644
--- a/ext/reflection/tests/bug29268.phpt
+++ b/ext/reflection/tests/bug29268.phpt
@@ -3,21 +3,21 @@ Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass
--FILE--
<?php
spl_autoload_register(function ($classname) {
- echo "__autoload($classname)\n";
- eval("class $classname {}");
+ echo "__autoload($classname)\n";
+ eval("class $classname {}");
});
class B{
- public function doit(A $a){
- }
+ public function doit(A $a){
+ }
}
$ref = new reflectionMethod('B','doit');
$parameters = $ref->getParameters();
foreach($parameters as $parameter)
{
- $class = $parameter->getClass();
- echo $class->name."\n";
+ $class = $parameter->getClass();
+ echo $class->name."\n";
}
echo "ok\n";
?>
diff --git a/ext/reflection/tests/bug29523.phpt b/ext/reflection/tests/bug29523.phpt
index fafc93ef40..a85612935e 100644
--- a/ext/reflection/tests/bug29523.phpt
+++ b/ext/reflection/tests/bug29523.phpt
@@ -16,15 +16,15 @@ $numberOfNotOptionalParameters = 0;
$numberOfOptionalParameters = 0;
foreach($function->getParameters() as $parameter)
{
- var_dump($parameter->isOptional());
- if ($parameter->isOptional())
- {
- ++$numberOfOptionalParameters;
- }
- else
- {
- ++$numberOfNotOptionalParameters;
- }
+ var_dump($parameter->isOptional());
+ if ($parameter->isOptional())
+ {
+ ++$numberOfOptionalParameters;
+ }
+ else
+ {
+ ++$numberOfNotOptionalParameters;
+ }
}
var_dump($function->getNumberOfRequiredParameters());
var_dump($numberOfNotOptionalParameters);
diff --git a/ext/reflection/tests/bug29828.phpt b/ext/reflection/tests/bug29828.phpt
index 43e32d2116..15c1229cc0 100644
--- a/ext/reflection/tests/bug29828.phpt
+++ b/ext/reflection/tests/bug29828.phpt
@@ -5,15 +5,15 @@ Reflection Bug #29828 (Interfaces no longer work)
interface Bla
{
- function bla();
+ function bla();
}
class BlaMore implements Bla
{
- function bla()
- {
- echo "Hello\n";
- }
+ function bla()
+ {
+ echo "Hello\n";
+ }
}
$r = new ReflectionClass('BlaMore');
@@ -26,10 +26,8 @@ $o=new BlaMore;
$o->bla();
?>
-===DONE===
--EXPECT--
int(1)
bool(false)
bool(false)
Hello
-===DONE===
diff --git a/ext/reflection/tests/bug30146.phpt b/ext/reflection/tests/bug30146.phpt
index 3f621414f1..d2e54324a7 100644
--- a/ext/reflection/tests/bug30146.phpt
+++ b/ext/reflection/tests/bug30146.phpt
@@ -15,9 +15,7 @@ var_dump($r->getValue());
$r->setValue(3);
var_dump($r->getValue());
?>
-===DONE===
--EXPECT--
int(1)
int(2)
int(3)
-===DONE===
diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt
deleted file mode 100644
index 27c31ca6ae..0000000000
--- a/ext/reflection/tests/bug30148.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes)
---FILE--
-<?php
-
-class Root
-{
- function Root() {}
-}
-class Base extends Root
-{
- function __construct() {}
-}
-class Derived extends Base
-{
-}
-$a = new ReflectionMethod('Root','Root');
-$b = new ReflectionMethod('Base','Root');
-$c = new ReflectionMethod('Base','__construct');
-$d = new ReflectionMethod('Derived','Root');
-$e = new ReflectionMethod('Derived','__construct');
-var_dump($a->isConstructor());
-var_dump($b->isConstructor());
-var_dump($c->isConstructor());
-var_dump($d->isConstructor());
-var_dump($e->isConstructor());
-?>
-===DONE===
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Root has a deprecated constructor in %s on line %d
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-===DONE===
diff --git a/ext/reflection/tests/bug30209.phpt b/ext/reflection/tests/bug30209.phpt
index bc1f6c7e86..0dc453e6c0 100644
--- a/ext/reflection/tests/bug30209.phpt
+++ b/ext/reflection/tests/bug30209.phpt
@@ -5,27 +5,25 @@ Reflection Bug #30209 (ReflectionClass::getMethod() lowercases attribute)
class Foo
{
- private $name = 'testBAR';
+ private $name = 'testBAR';
- public function testBAR()
- {
- try
- {
- $class = new ReflectionClass($this);
- var_dump($this->name);
- $method = $class->getMethod($this->name);
- var_dump($this->name);
- }
+ public function testBAR()
+ {
+ try
+ {
+ $class = new ReflectionClass($this);
+ var_dump($this->name);
+ $method = $class->getMethod($this->name);
+ var_dump($this->name);
+ }
- catch (Exception $e) {}
- }
+ catch (Exception $e) {}
+ }
}
$foo = new Foo;
$foo->testBAR();
?>
-===DONE===
--EXPECT--
string(7) "testBAR"
string(7) "testBAR"
-===DONE===
diff --git a/ext/reflection/tests/bug30856.phpt b/ext/reflection/tests/bug30856.phpt
index 39fc1104ab..23d50b17a7 100644
--- a/ext/reflection/tests/bug30856.phpt
+++ b/ext/reflection/tests/bug30856.phpt
@@ -11,10 +11,8 @@ $class = new ReflectionClass('bogus');
var_dump($class->getStaticProperties());
?>
-===DONE===
--EXPECT--
array(1) {
["a"]=>
string(4) "test"
}
-===DONE===
diff --git a/ext/reflection/tests/bug31651.phpt b/ext/reflection/tests/bug31651.phpt
index 59f19eae5d..e356baf148 100644
--- a/ext/reflection/tests/bug31651.phpt
+++ b/ext/reflection/tests/bug31651.phpt
@@ -5,7 +5,7 @@ Reflection Bug #31651 (ReflectionClass::getDefaultProperties segfaults with arra
class Test
{
- public $a = array('a' => 1);
+ public $a = array('a' => 1);
}
$ref = new ReflectionClass('Test');
diff --git a/ext/reflection/tests/bug32981.phpt b/ext/reflection/tests/bug32981.phpt
index 5735674585..fc6960866f 100644
--- a/ext/reflection/tests/bug32981.phpt
+++ b/ext/reflection/tests/bug32981.phpt
@@ -5,23 +5,22 @@ Reflection Bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.5
class TestClass
{
- static function test()
- {
- static $enabled = true;
- }
+ static function test()
+ {
+ static $enabled = true;
+ }
}
$class = new ReflectionClass('TestClass');
foreach ($class->getMethods() as $method)
{
- var_dump($method->getName());
- $arr_static_vars[] = $method->getStaticVariables();
+ var_dump($method->getName());
+ $arr_static_vars[] = $method->getStaticVariables();
}
var_dump($arr_static_vars);
?>
-===DONE===
--EXPECT--
string(4) "test"
array(1) {
@@ -31,4 +30,3 @@ array(1) {
bool(true)
}
}
-===DONE===
diff --git a/ext/reflection/tests/bug36434.phpt b/ext/reflection/tests/bug36434.phpt
index 502ac741a9..04cdcbf01d 100644
--- a/ext/reflection/tests/bug36434.phpt
+++ b/ext/reflection/tests/bug36434.phpt
@@ -5,24 +5,24 @@ Reflection Bug #36434 (Properties from parent class fail to indetify their true
class ancester
{
public $ancester = 0;
- function __construct()
- {
- return $this->ancester;
- }
+ function __construct()
+ {
+ return $this->ancester;
+ }
}
class foo extends ancester
{
public $bar = "1";
- function __construct()
- {
- return $this->bar;
- }
+ function __construct()
+ {
+ return $this->bar;
+ }
}
$r = new ReflectionClass('foo');
foreach ($r->GetProperties() as $p)
{
- echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n";
+ echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n";
}
?>
diff --git a/ext/reflection/tests/bug37816.phpt b/ext/reflection/tests/bug37816.phpt
index 89ca3238b6..eec6f09411 100644
--- a/ext/reflection/tests/bug37816.phpt
+++ b/ext/reflection/tests/bug37816.phpt
@@ -5,7 +5,7 @@ Bug #37816 (ReflectionProperty does not throw exception when accessing protected
class TestClass
{
- protected $p = 2;
+ protected $p = 2;
}
$o = new TestClass;
@@ -14,15 +14,13 @@ $r = new ReflectionProperty($o, 'p');
try
{
- $x = $r->getValue($o);
+ $x = $r->getValue($o);
}
catch (Exception $e)
{
- echo 'Caught: ' . $e->getMessage() . "\n";
+ echo 'Caught: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
Caught: Cannot access non-public member TestClass::$p
-===DONE===
diff --git a/ext/reflection/tests/bug37964.phpt b/ext/reflection/tests/bug37964.phpt
index f3ebe9f72a..59b5f85590 100644
--- a/ext/reflection/tests/bug37964.phpt
+++ b/ext/reflection/tests/bug37964.phpt
@@ -4,19 +4,19 @@ Reflection Bug #37964 (Reflection shows private methods of parent class)
<?php
abstract class foobar {
- private function test2() {
- }
+ private function test2() {
+ }
}
class foo extends foobar {
- private $foo = 1;
- private function test() {
- }
- protected function test3() {
- }
+ private $foo = 1;
+ private function test() {
+ }
+ protected function test3() {
+ }
}
class bar extends foo {
- private function foobar() {
- }
+ private function foobar() {
+ }
}
echo new ReflectionClass(new bar);
diff --git a/ext/reflection/tests/bug38132.phpt b/ext/reflection/tests/bug38132.phpt
index 16e56411f2..e500616604 100644
--- a/ext/reflection/tests/bug38132.phpt
+++ b/ext/reflection/tests/bug38132.phpt
@@ -3,8 +3,8 @@ Reflection Bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key
--FILE--
<?php
class foo {
- static protected $bar = 'baz';
- static public $a = 'a';
+ static protected $bar = 'baz';
+ static public $a = 'a';
}
$class = new ReflectionClass('foo');
diff --git a/ext/reflection/tests/bug38217.phpt b/ext/reflection/tests/bug38217.phpt
index 46f2dc3e0e..cc7525c813 100644
--- a/ext/reflection/tests/bug38217.phpt
+++ b/ext/reflection/tests/bug38217.phpt
@@ -4,24 +4,24 @@ Bug #38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory
<?php
class ObjectOne {
- public function __construct() {
- }
+ public function __construct() {
+ }
}
$class= new ReflectionClass('ObjectOne');
var_dump($class->newInstanceArgs());
class ObjectTwo {
- public function __construct($var) {
- var_dump($var);
- }
+ public function __construct($var) {
+ var_dump($var);
+ }
}
$class= new ReflectionClass('ObjectTwo');
try {
- var_dump($class->newInstanceArgs());
+ var_dump($class->newInstanceArgs());
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
var_dump($class->newInstanceArgs(array('test')));
diff --git a/ext/reflection/tests/bug38653.phpt b/ext/reflection/tests/bug38653.phpt
index 64b1aad15b..36504e7c7b 100644
--- a/ext/reflection/tests/bug38653.phpt
+++ b/ext/reflection/tests/bug38653.phpt
@@ -4,9 +4,9 @@ Bug #38653 (memory leak in ReflectionClass::getConstant())
<?php
class foo {
- const cons = 10;
- const cons1 = "";
- const cons2 = "test";
+ const cons = 10;
+ const cons1 = "";
+ const cons2 = "test";
}
class bar extends foo {
diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt
deleted file mode 100644
index 6dbe396ae6..0000000000
--- a/ext/reflection/tests/bug38942.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Bug #38942 (Double old-style-ctor inheritance)
---FILE--
-<?php
-class foo {
- public function foo() {}
-}
-
-class bar extends foo {
-}
-echo new ReflectionClass("bar");
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
-Class [ <user> class bar extends foo ] {
- @@ %sbug38942.php 6-7
-
- - Constants [0] {
- }
-
- - Static properties [0] {
- }
-
- - Static methods [0] {
- }
-
- - Properties [0] {
- }
-
- - Methods [1] {
- Method [ <user, inherits foo, ctor> public method foo ] {
- @@ %sbug38942.php 3 - 3
- }
- }
-}
diff --git a/ext/reflection/tests/bug39001.phpt b/ext/reflection/tests/bug39001.phpt
index ec4b7a5d1b..1e390341e7 100644
--- a/ext/reflection/tests/bug39001.phpt
+++ b/ext/reflection/tests/bug39001.phpt
@@ -7,8 +7,8 @@ class Meta {
}
class CParent extends Meta {
- public $publicVar;
- protected $protectedVar;
+ public $publicVar;
+ protected $protectedVar;
}
class Child extends CParent {
diff --git a/ext/reflection/tests/bug39067.phpt b/ext/reflection/tests/bug39067.phpt
index f549f794e0..05ce90be46 100644
--- a/ext/reflection/tests/bug39067.phpt
+++ b/ext/reflection/tests/bug39067.phpt
@@ -4,15 +4,15 @@ Bug #39067 (getDeclaringClass() and private properties)
<?php
class A {
- private $x;
+ private $x;
}
class B extends A {
- private $x;
+ private $x;
}
class C extends B {
- private $x;
+ private $x;
}
$rc = new ReflectionClass('C');
@@ -25,11 +25,11 @@ $rc = new ReflectionClass('A');
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
class Test {
- private $x;
+ private $x;
}
class Test2 extends Test {
- public $x;
+ public $x;
}
$rc = new ReflectionClass('Test2');
diff --git a/ext/reflection/tests/bug40431.phpt b/ext/reflection/tests/bug40431.phpt
index 637b1457cd..41620a3926 100644
--- a/ext/reflection/tests/bug40431.phpt
+++ b/ext/reflection/tests/bug40431.phpt
@@ -56,7 +56,7 @@ var_dump($props[0]->isProtected());
echo "=== 4th test ===\n";
class test5 {
- private $value = 1;
+ private $value = 1;
}
class test4 extends test5{
diff --git a/ext/reflection/tests/bug40794.phpt b/ext/reflection/tests/bug40794.phpt
index c1830ddcd2..1f1bb61c58 100644
--- a/ext/reflection/tests/bug40794.phpt
+++ b/ext/reflection/tests/bug40794.phpt
@@ -13,7 +13,7 @@ $reflect = new ReflectionObject($obj);
$array = array();
foreach($reflect->getProperties() as $prop)
{
- $array[$prop->getName()] = $prop->getValue($obj);
+ $array[$prop->getName()] = $prop->getValue($obj);
}
var_dump($array);
diff --git a/ext/reflection/tests/bug41061.phpt b/ext/reflection/tests/bug41061.phpt
index 027b872be9..df807566db 100644
--- a/ext/reflection/tests/bug41061.phpt
+++ b/ext/reflection/tests/bug41061.phpt
@@ -14,8 +14,6 @@ class bar {
echo new ReflectionFunction('foo'), "\n";
echo new ReflectionMethod('bar', 'foo'), "\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Function [ <user> function foo ] {
@@ %sbug41061.php 3 - 4
@@ -25,4 +23,3 @@ Method [ <user> private method foo ] {
@@ %sbug41061.php 7 - 8
}
-===DONE===
diff --git a/ext/reflection/tests/bug41884.phpt b/ext/reflection/tests/bug41884.phpt
index 25d2b7cb74..ae9655765e 100644
--- a/ext/reflection/tests/bug41884.phpt
+++ b/ext/reflection/tests/bug41884.phpt
@@ -5,8 +5,8 @@ Bug #41884 (ReflectionClass::getDefaultProperties() does not handle static attri
class Foo
{
- protected static $fooStatic = 'foo';
- protected $foo = 'foo';
+ protected static $fooStatic = 'foo';
+ protected $foo = 'foo';
}
$class = new ReflectionClass('Foo');
diff --git a/ext/reflection/tests/bug42976.phpt b/ext/reflection/tests/bug42976.phpt
index 0b147aa811..5e5c3c5be5 100644
--- a/ext/reflection/tests/bug42976.phpt
+++ b/ext/reflection/tests/bug42976.phpt
@@ -4,9 +4,9 @@ Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails)
<?php
Class C {
- function __construct(&$x) {
- $x = "x.changed";
- }
+ function __construct(&$x) {
+ $x = "x.changed";
+ }
}
$x = "x.original";
@@ -26,9 +26,9 @@ echo "Done\n";
--EXPECTF--
string(9) "x.changed"
-Warning: Parameter 1 to C::__construct() expected to be a reference, value given in %sbug42976.php on line 15
+Warning: C::__construct(): Argument #1 ($x) must be passed by reference, value given in %s on line %d
string(10) "x.original"
-Warning: Parameter 1 to C::__construct() expected to be a reference, value given in %sbug42976.php on line 18
+Warning: C::__construct(): Argument #1 ($x) must be passed by reference, value given in %s on line %d
string(10) "x.original"
Done
diff --git a/ext/reflection/tests/bug45139.phpt b/ext/reflection/tests/bug45139.phpt
index 6aa84263c6..5a8f62d0cd 100644
--- a/ext/reflection/tests/bug45139.phpt
+++ b/ext/reflection/tests/bug45139.phpt
@@ -4,19 +4,19 @@ Bug #45139 (ReflectionProperty returns incorrect declaring class)
<?php
class A {
- private $foo;
+ private $foo;
}
class B extends A {
- protected $bar;
- private $baz;
- private $quux;
+ protected $bar;
+ private $baz;
+ private $quux;
}
class C extends B {
- public $foo;
- private $baz;
- protected $quux;
+ public $foo;
+ private $baz;
+ protected $quux;
}
$rc = new ReflectionClass('C');
diff --git a/ext/reflection/tests/bug45571.phpt b/ext/reflection/tests/bug45571.phpt
index 74245fc24c..7b48859564 100644
--- a/ext/reflection/tests/bug45571.phpt
+++ b/ext/reflection/tests/bug45571.phpt
@@ -4,12 +4,12 @@ Bug #45571 (ReflectionClass::__toString() shows superclasses' private static met
<?php
Class A {
- static private $a = 0;
- static protected $b = 1;
- static public $c = 2;
+ static private $a = 0;
+ static protected $b = 1;
+ static public $c = 2;
- private function f() {}
- private static function sf() {}
+ private function f() {}
+ private static function sf() {}
}
Class C extends A { }
@@ -25,8 +25,8 @@ Class [ <user> class C extends A ] {
}
- Static properties [2] {
- Property [ protected static $b ]
- Property [ public static $c ]
+ Property [ protected static $b = 1 ]
+ Property [ public static $c = 2 ]
}
- Static methods [0] {
diff --git a/ext/reflection/tests/bug45765.phpt b/ext/reflection/tests/bug45765.phpt
index 5c33faca2b..af8dd9b47a 100644
--- a/ext/reflection/tests/bug45765.phpt
+++ b/ext/reflection/tests/bug45765.phpt
@@ -4,23 +4,23 @@ Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an
<?php
class foo2 {
- const BAR = 'foobar';
+ const BAR = 'foobar';
}
class foo extends foo2 {
- const BAR = "foo's bar";
+ const BAR = "foo's bar";
- function test($a = self::BAR) {
- }
+ function test($a = self::BAR) {
+ }
- function test2($a = parent::BAR) {
- }
+ function test2($a = parent::BAR) {
+ }
- function test3($a = foo::BAR) {
- }
+ function test3($a = foo::BAR) {
+ }
- function test4($a = foo2::BAR) {
- }
+ function test4($a = foo2::BAR) {
+ }
}
echo new ReflectionObject(new foo);
diff --git a/ext/reflection/tests/bug46064.phpt b/ext/reflection/tests/bug46064.phpt
index d8ee411905..4a97b3b22a 100644
--- a/ext/reflection/tests/bug46064.phpt
+++ b/ext/reflection/tests/bug46064.phpt
@@ -4,7 +4,7 @@ Bug #46064 (Exception when creating ReflectionProperty object on dynamicly creat
<?php
class x {
- public $zzz = 2;
+ public $zzz = 2;
}
$o = new x;
@@ -21,31 +21,30 @@ var_dump($h->getValue($o));
print "---------------------------\n";
try {
- var_dump(new reflectionproperty($o, 'zz'));
+ var_dump(new reflectionproperty($o, 'zz'));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
var_dump(new reflectionproperty($o, 'zzz'));
class test {
- protected $a = 1;
+ protected $a = 1;
}
class bar extends test {
- public function __construct() {
- $this->foobar = 2;
- $this->a = 200;
+ public function __construct() {
+ $this->foobar = 2;
+ $this->a = 200;
- $p = new reflectionproperty($this, 'foobar');
- var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
- }
+ $p = new reflectionproperty($this, 'foobar');
+ var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
+ }
}
new bar;
?>
-===DONE===
--EXPECTF--
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -73,4 +72,3 @@ object(ReflectionProperty)#%d (2) {
int(2)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/bug46064_2.phpt b/ext/reflection/tests/bug46064_2.phpt
index 65afa836b7..f1aac5b5c0 100644
--- a/ext/reflection/tests/bug46064_2.phpt
+++ b/ext/reflection/tests/bug46064_2.phpt
@@ -15,28 +15,27 @@ var_dump($p->getProperty('test'));
class bar {
- public function __construct() {
- $this->a = 1;
- }
+ public function __construct() {
+ $this->a = 1;
+ }
}
class test extends bar {
- private $b = 2;
+ private $b = 2;
- public function __construct() {
- parent::__construct();
+ public function __construct() {
+ parent::__construct();
- $p = new reflectionobject($this);
- var_dump($h = $p->getProperty('a'));
- var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic());
- var_dump($p->getProperties());
- }
+ $p = new reflectionobject($this);
+ var_dump($h = $p->getProperty('a'));
+ var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic());
+ var_dump($p->getProperties());
+ }
}
new test;
?>
-===DONE===
--EXPECTF--
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -71,4 +70,3 @@ array(2) {
string(4) "test"
}
}
-===DONE===
diff --git a/ext/reflection/tests/bug46205.phpt b/ext/reflection/tests/bug46205.phpt
deleted file mode 100644
index 5ca8ac1cd0..0000000000
--- a/ext/reflection/tests/bug46205.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #46205 (Closure - Memory leaks when ReflectionException is thrown)
---FILE--
-<?php
-$x = new reflectionmethod('reflectionparameter', 'export');
-$y = function() { };
-
-try {
- $x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1));
-} catch (Exception $e) { }
-?>
-ok
---EXPECTF--
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-ok
diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt
index e3ce114c9c..6330d6603f 100644
--- a/ext/reflection/tests/bug47254.phpt
+++ b/ext/reflection/tests/bug47254.phpt
@@ -8,13 +8,13 @@ Testfest 2009 Munich
<?php
class A
{
- protected function a() {}
+ protected function a() {}
}
class B extends A
{
- public function b() {}
+ public function b() {}
}
$B = new B();
@@ -23,10 +23,7 @@ $m = $R->getMethods();
print_r($m);
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
+--EXPECT--
Array
(
[0] => ReflectionMethod Object
diff --git a/ext/reflection/tests/bug48757.phpt b/ext/reflection/tests/bug48757.phpt
index a5ced91d3a..45393470d3 100644
--- a/ext/reflection/tests/bug48757.phpt
+++ b/ext/reflection/tests/bug48757.phpt
@@ -3,11 +3,11 @@ Bug #48757 (ReflectionFunction::invoke() parameter issues)
--FILE--
<?php
function test() {
- echo "Hello World\n";
+ echo "Hello World\n";
}
function another_test($parameter) {
- var_dump($parameter);
+ var_dump($parameter);
}
$func = new ReflectionFunction('test');
diff --git a/ext/reflection/tests/bug49074.phpt b/ext/reflection/tests/bug49074.phpt
index 7ce23b41e4..b39814cdf6 100644
--- a/ext/reflection/tests/bug49074.phpt
+++ b/ext/reflection/tests/bug49074.phpt
@@ -3,13 +3,13 @@ Bug #49074 (private class static fields can be modified by using reflection)
--FILE--
<?php
class Test {
- private static $data1 = 1;
- private static $data4 = 4;
+ private static $data1 = 1;
+ private static $data4 = 4;
}
class Test2 extends Test {
- private static $data2 = 2;
- public static $data3 = 3;
+ private static $data2 = 2;
+ public static $data3 = 3;
}
$r = new ReflectionClass('Test2');
diff --git a/ext/reflection/tests/bug49719.phpt b/ext/reflection/tests/bug49719.phpt
index 6211b6b543..37f6ae38af 100644
--- a/ext/reflection/tests/bug49719.phpt
+++ b/ext/reflection/tests/bug49719.phpt
@@ -4,30 +4,30 @@ Bug #49719 (ReflectionClass::hasProperty returns true for a private property in
<?php
class A {
- private $a;
+ private $a;
}
class B extends A {
- private $b;
+ private $b;
}
try {
- $b = new B;
- $ref = new ReflectionClass($b);
+ $b = new B;
+ $ref = new ReflectionClass($b);
- var_dump(property_exists('b', 'a'));
- var_dump(property_exists($b, 'a'));
- var_dump($ref->hasProperty('a'));
- var_dump($ref->getProperty('a'));
+ var_dump(property_exists('b', 'a'));
+ var_dump(property_exists($b, 'a'));
+ var_dump($ref->hasProperty('a'));
+ var_dump($ref->getProperty('a'));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
class A2 {
- private $a = 1;
+ private $a = 1;
}
class B2 extends A2 {
- private $a = 2;
+ private $a = 2;
}
$b2 = new ReflectionClass('B2');
diff --git a/ext/reflection/tests/bug51905.phpt b/ext/reflection/tests/bug51905.phpt
index 8969924e45..2d956386a5 100644
--- a/ext/reflection/tests/bug51905.phpt
+++ b/ext/reflection/tests/bug51905.phpt
@@ -4,12 +4,12 @@ Bug #51905 (ReflectionParameter fails if default value is an array with an acces
<?php
class Bar {
- const Y = 20;
+ const Y = 20;
}
class Foo extends Bar {
- const X = 12;
- public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
+ const X = 12;
+ public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
}
$clazz = new ReflectionClass('Foo');
diff --git a/ext/reflection/tests/bug52854.phpt b/ext/reflection/tests/bug52854.phpt
index 255522de5d..2d174bc11e 100644
--- a/ext/reflection/tests/bug52854.phpt
+++ b/ext/reflection/tests/bug52854.phpt
@@ -11,9 +11,9 @@ var_dump($c->newInstance());
var_dump($c->newInstanceArgs(array()));
try {
- var_dump($c->newInstanceArgs(array(1)));
+ var_dump($c->newInstanceArgs(array(1)));
} catch(ReflectionException $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
--EXPECTF--
diff --git a/ext/reflection/tests/bug53366.phpt b/ext/reflection/tests/bug53366.phpt
index 5fb119d820..61493d5302 100644
--- a/ext/reflection/tests/bug53366.phpt
+++ b/ext/reflection/tests/bug53366.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #53366 (Reflection doesnt get dynamic property value from getProperty())
+Bug #53366 (Reflection doesn't get dynamic property value from getProperty())
--FILE--
<?php
diff --git a/ext/reflection/tests/bug53915.phpt b/ext/reflection/tests/bug53915.phpt
index f2f2ae5675..f4df7cc839 100644
--- a/ext/reflection/tests/bug53915.phpt
+++ b/ext/reflection/tests/bug53915.phpt
@@ -4,8 +4,8 @@ Bug #53915 - ReflectionClass::getConstant(s) emits fatal error on selfreferencin
<?php
Class Foo
{
- const A = 1;
- const B = self::A;
+ const A = 1;
+ const B = self::A;
}
$rc = new ReflectionClass('Foo');
diff --git a/ext/reflection/tests/bug60367.phpt b/ext/reflection/tests/bug60367.phpt
index 3834445733..afc67ccc47 100644
--- a/ext/reflection/tests/bug60367.phpt
+++ b/ext/reflection/tests/bug60367.phpt
@@ -4,17 +4,17 @@ Bug #60367 (Reflection and Late Static Binding)
<?php
abstract class A {
- const WHAT = 'A';
+ const WHAT = 'A';
- public static function call() {
- echo static::WHAT;
- }
+ public static function call() {
+ echo static::WHAT;
+ }
}
class B extends A {
- const WHAT = 'B';
+ const WHAT = 'B';
}
diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt
index feb67f614b..63339cddc1 100644
--- a/ext/reflection/tests/bug62715.phpt
+++ b/ext/reflection/tests/bug62715.phpt
@@ -16,7 +16,8 @@ foreach ($r->getParameters() as $p) {
}
}
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Required parameter $c follows optional parameter $b in %s on line %d
bool(true)
bool(true)
bool(false)
diff --git a/ext/reflection/tests/bug64239.phpt b/ext/reflection/tests/bug64239.phpt
index 9acdc1987b..100c09d2eb 100644
--- a/ext/reflection/tests/bug64239.phpt
+++ b/ext/reflection/tests/bug64239.phpt
@@ -3,11 +3,11 @@ Bug #64239 (ReflectionClass::getMethods() changed behavior)
--FILE--
<?php
class A {
- use T2 { t2method as Bmethod; }
+ use T2 { t2method as Bmethod; }
}
trait T2 {
- public function t2method() {
- }
+ public function t2method() {
+ }
}
class B extends A{
diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt
index c3e781805e..ae63d43008 100644
--- a/ext/reflection/tests/bug64936.phpt
+++ b/ext/reflection/tests/bug64936.phpt
@@ -9,8 +9,8 @@ opcache.save_comments=1
function strip_doc_comment($c)
{
- if (!strlen($c) || $c === false) return $c;
- return trim(substr($c, 3, -2));
+ if (!strlen($c) || $c === false) return $c;
+ return trim(substr($c, 3, -2));
}
token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
@@ -28,8 +28,6 @@ $rb = new ReflectionClass('B');
var_dump(strip_doc_comment($rb->getDocComment()));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
-===DONE===
diff --git a/ext/reflection/tests/bug66430.phpt b/ext/reflection/tests/bug66430.phpt
index 921e2c99d8..bd3100b47b 100644
--- a/ext/reflection/tests/bug66430.phpt
+++ b/ext/reflection/tests/bug66430.phpt
@@ -4,11 +4,11 @@ Bug #66430: ReflectionFunction::invoke does not invoke closure with object scope
<?php
class Alpha {
- public $message = "Valid representation";
+ public $message = "Valid representation";
- public function bravo() {
- return $this->message;
- }
+ public function bravo() {
+ return $this->message;
+ }
}
$alpha = new Alpha();
diff --git a/ext/reflection/tests/bug69180.phpt b/ext/reflection/tests/bug69180.phpt
new file mode 100644
index 0000000000..80d69dcd5c
--- /dev/null
+++ b/ext/reflection/tests/bug69180.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #69180: Reflection does not honor trait conflict resolution / method aliasing
+--FILE--
+<?php
+
+trait T1
+{
+ public function foo()
+ {
+ }
+}
+
+trait T2
+{
+ use T1 { foo as bar; }
+
+ public function foo()
+ {
+ }
+}
+
+
+class C
+{
+ use T2;
+}
+
+$class = new ReflectionClass('C');
+
+foreach ($class->getMethods() as $method) {
+ var_dump($method->getName());
+}
+
+?>
+--EXPECT--
+string(3) "foo"
+string(3) "bar"
diff --git a/ext/reflection/tests/bug70982.phpt b/ext/reflection/tests/bug70982.phpt
index d530846f64..644531e373 100644
--- a/ext/reflection/tests/bug70982.phpt
+++ b/ext/reflection/tests/bug70982.phpt
@@ -3,11 +3,11 @@ Bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6)
--FILE--
<?php
class Foo {
- static $abc;
- function __construct()
- {
- var_dump(self::$abc);
- }
+ static $abc;
+ function __construct()
+ {
+ var_dump(self::$abc);
+ }
}
class Bar extends Foo {
diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt
index 46ba048078..b1cb764beb 100644
--- a/ext/reflection/tests/bug72661.phpt
+++ b/ext/reflection/tests/bug72661.phpt
@@ -6,6 +6,5 @@ function test(iterable $arg) { }
var_dump((string)(new ReflectionParameter("test", 0))->getType());
?>
---EXPECTF--
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+--EXPECT--
string(8) "iterable"
diff --git a/ext/reflection/tests/bug74454.inc b/ext/reflection/tests/bug74454.inc
index 5136591367..e668e88643 100644
--- a/ext/reflection/tests/bug74454.inc
+++ b/ext/reflection/tests/bug74454.inc
@@ -1,4 +1,4 @@
<?php
class A {
- if (wrongsyntax)
+ if (wrongsyntax)
}
diff --git a/ext/reflection/tests/bug74454.phpt b/ext/reflection/tests/bug74454.phpt
index 9e0332d893..e311ab3beb 100644
--- a/ext/reflection/tests/bug74454.phpt
+++ b/ext/reflection/tests/bug74454.phpt
@@ -4,16 +4,14 @@ Bug #74454 (Wrong exception being thrown when using ReflectionMethod)
<?php
spl_autoload_register('load_file');
try {
- $x = new ReflectionMethod('A', 'b');
+ $x = new ReflectionMethod('A', 'b');
} catch (\Throwable $e) {
- echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+ echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
}
function load_file() {
- require __DIR__ . '/bug74454.inc';
+ require __DIR__ . '/bug74454.inc';
}
?>
-===DONE===
--EXPECT--
ParseError: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) or const (T_CONST)
-===DONE===
diff --git a/ext/reflection/tests/bug74673.phpt b/ext/reflection/tests/bug74673.phpt
index 47f7604e8b..321195c16e 100644
--- a/ext/reflection/tests/bug74673.phpt
+++ b/ext/reflection/tests/bug74673.phpt
@@ -3,15 +3,11 @@ Bug #74673 (Segfault when cast Reflection object to string with undefined consta
--FILE--
<?php
-set_error_handler(function() {
- throw new Exception();
-});
-
class A
{
- public function method($test = PHP_SELF + 1)
- {
- }
+ public function method($test = PHP_SELF + 1)
+ {
+ }
}
$class = new ReflectionClass('A');
@@ -19,9 +15,8 @@ $class = new ReflectionClass('A');
echo $class;
?>
--EXPECTF--
-Fatal error: Uncaught Exception in %s:%d
+Fatal error: Uncaught Error: Undefined constant 'PHP_SELF' in %s:%d
Stack trace:
-#0 [internal function]: {closure}(2, 'Use of undefine...', %s, %d, Array)
-#1 %s(%d): ReflectionClass->__toString()
-#2 {main}
+#0 %s(%d): ReflectionClass->__toString()
+#1 {main}
thrown in %s on line %d
diff --git a/ext/reflection/tests/bug74949.phpt b/ext/reflection/tests/bug74949.phpt
index 2970c5911f..20e0fc00e1 100644
--- a/ext/reflection/tests/bug74949.phpt
+++ b/ext/reflection/tests/bug74949.phpt
@@ -12,9 +12,9 @@ unset($f);
echo $r, "\n";
try {
- echo $r->getPrototype();
+ echo $r->getPrototype();
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/bug76536.phpt b/ext/reflection/tests/bug76536.phpt
index 9f3b3fdb31..aa32781e16 100644
--- a/ext/reflection/tests/bug76536.phpt
+++ b/ext/reflection/tests/bug76536.phpt
@@ -2,7 +2,7 @@
Bug #76536 (PHP crashes with core dump when throwing exception in error handler)
--FILE--
<?php
-class SomeConstants {const SOME_CONSTANT = SOME_NONSENSE;}
+class SomeConstants {const SOME_CONSTANT = "foo" % 5; }
function handleError() {throw new ErrorException();}
diff --git a/ext/reflection/tests/bug77325.phpt b/ext/reflection/tests/bug77325.phpt
new file mode 100644
index 0000000000..f451b21ac9
--- /dev/null
+++ b/ext/reflection/tests/bug77325.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #77325: ReflectionClassConstant::$class returns wrong class when extending
+--FILE--
+<?php
+
+class Foo {
+ const FOO = 'foo';
+}
+
+class Bar extends Foo {
+}
+
+$barClassReflection = new ReflectionClass(Bar::class);
+$constants = $barClassReflection->getReflectionConstants();
+foreach ($constants as $constant) {
+ var_dump($constant->class);
+ var_dump($constant->getDeclaringClass()->getName());
+}
+
+$constant = new ReflectionClassConstant(Bar::class, 'FOO');
+var_dump($constant->class);
+var_dump($constant->getDeclaringClass()->getName());
+
+?>
+--EXPECT--
+string(3) "Foo"
+string(3) "Foo"
+string(3) "Foo"
+string(3) "Foo"
diff --git a/ext/reflection/tests/bug77882.phpt b/ext/reflection/tests/bug77882.phpt
index ff1d212861..71e430d178 100644
--- a/ext/reflection/tests/bug77882.phpt
+++ b/ext/reflection/tests/bug77882.phpt
@@ -7,7 +7,7 @@ class Test {
public function __construct() {
throw new Exception();
}
-
+
public function __destruct() {
echo "__destruct\n";
}
diff --git a/ext/reflection/tests/bug78774.phpt b/ext/reflection/tests/bug78774.phpt
index 1e419b1138..7f72039e07 100644
--- a/ext/reflection/tests/bug78774.phpt
+++ b/ext/reflection/tests/bug78774.phpt
@@ -5,18 +5,24 @@ Bug #78774: ReflectionNamedType on Typed Properties Crash
class Test {
public stdClass $prop;
+ public stdClass|Foo $prop2;
}
$rc = new ReflectionClass(Test::class);
$rp = $rc->getProperty('prop');
$rt = $rp->getType();
+$rp2 = $rc->getProperty('prop2');
+$rt2 = $rp2->getType();
// Force a resolution of the property type
$test = new Test;
$test->prop = new stdClass;
+$test->prop2 = new stdClass;
var_dump($rt->getName());
+var_dump((string) $rt2);
?>
--EXPECT--
string(8) "stdClass"
+string(12) "stdClass|Foo"
diff --git a/ext/reflection/tests/bug78895.phpt b/ext/reflection/tests/bug78895.phpt
index 7e616c4456..b5f84e2d02 100644
--- a/ext/reflection/tests/bug78895.phpt
+++ b/ext/reflection/tests/bug78895.phpt
@@ -3,18 +3,18 @@ Fixed bug #78895 (Reflection detects abstract non-static class as abstract stati
--FILE--
<?php
abstract class Foo {
- abstract public function f1();
+ abstract public function f1();
}
interface I {
- public function f2();
+ public function f2();
}
trait T {
- abstract public function f2();
+ abstract public function f2();
}
class Bar extends Foo implements I {
- use T;
- function f1() {}
- function f2() {}
+ use T;
+ function f1() {}
+ function f2() {}
}
$ref = new ReflectionClass(Foo::class);
var_dump(Reflection::getModifierNames($ref->getModifiers()));
diff --git a/ext/reflection/tests/closures_001.phpt b/ext/reflection/tests/closures_001.phpt
index 57c1b4e3f6..56581c05b8 100644
--- a/ext/reflection/tests/closures_001.phpt
+++ b/ext/reflection/tests/closures_001.phpt
@@ -11,10 +11,10 @@ var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
$rms = $ro->getMethods();
foreach($rms as $rm) {
- if ($rm->getName() == '__invoke') {
- var_dump($rm->getNumberOfParameters());
- var_dump($rm->getNumberOfRequiredParameters());
- }
+ if ($rm->getName() == '__invoke') {
+ var_dump($rm->getNumberOfParameters());
+ var_dump($rm->getNumberOfRequiredParameters());
+ }
}
echo "---\n";
@@ -47,7 +47,6 @@ $rp = new ReflectionParameter($closure, 'b');
var_dump($rp->isOptional());
?>
-===DONE===
--EXPECT--
int(2)
int(1)
@@ -67,4 +66,3 @@ bool(false)
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/closures_002.phpt b/ext/reflection/tests/closures_002.phpt
index ed973b56c1..9e606857b6 100644
--- a/ext/reflection/tests/closures_002.phpt
+++ b/ext/reflection/tests/closures_002.phpt
@@ -1,10 +1,10 @@
--TEST--
-Reflection on invokable objects
+Reflection on invocable objects
--FILE--
<?php
class Test {
- function __invoke($a, $b = 0) { }
+ function __invoke($a, $b = 0) { }
}
$rm = new ReflectionMethod(new Test, '__invoke');
@@ -19,11 +19,9 @@ $rp = new ReflectionParameter(array(new Test, '__invoke'), 1);
var_dump($rp->isOptional());
?>
-===DONE===
--EXPECT--
string(8) "__invoke"
int(2)
int(1)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/closures_003.phpt b/ext/reflection/tests/closures_003.phpt
index 57245cacde..e50d9c466f 100644
--- a/ext/reflection/tests/closures_003.phpt
+++ b/ext/reflection/tests/closures_003.phpt
@@ -18,8 +18,6 @@ unset ($parameter);
echo $method->getName ()."\n";
?>
-===DONE===
--EXPECT--
__invoke
__invoke
-===DONE===
diff --git a/ext/reflection/tests/closures_003_v1.phpt b/ext/reflection/tests/closures_003_v1.phpt
index cf853a00fd..1ae5502a39 100644
--- a/ext/reflection/tests/closures_003_v1.phpt
+++ b/ext/reflection/tests/closures_003_v1.phpt
@@ -18,8 +18,6 @@ unset ($parameter);
echo $method->getName ()."\n";
?>
-===DONE===
--EXPECT--
{closure}
{closure}
-===DONE===
diff --git a/ext/reflection/tests/closures_004.phpt b/ext/reflection/tests/closures_004.phpt
index e2b52c5429..479c7c3e67 100644
--- a/ext/reflection/tests/closures_004.phpt
+++ b/ext/reflection/tests/closures_004.phpt
@@ -30,7 +30,6 @@ $closure2 ();
$closure2->__invoke ();
?>
-===DONE===
--EXPECT--
Invoked!
Invoked!
@@ -40,4 +39,3 @@ Invoked!
Invoked!
Invoked!
Invoked!
-===DONE===
diff --git a/ext/reflection/tests/included4.inc b/ext/reflection/tests/included4.inc
index 313fc5feca..7b64eb29cf 100644
--- a/ext/reflection/tests/included4.inc
+++ b/ext/reflection/tests/included4.inc
@@ -3,7 +3,7 @@ echo __FILE__ . "\n";
echo __LINE__ . "\n";
function g() {
- echo __FILE__ . "\n";
- echo __LINE__ . "\n";
+ echo __FILE__ . "\n";
+ echo __LINE__ . "\n";
}
?>
diff --git a/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValueConstantName_Internal.phpt b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValueConstantName_Internal.phpt
new file mode 100644
index 0000000000..b013c9db66
--- /dev/null
+++ b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValueConstantName_Internal.phpt
@@ -0,0 +1,53 @@
+--TEST--
+ReflectionParameter::getDefaultValueConstantName() should also work for parameters of internal functions.
+--FILE--
+<?php
+$class = new ReflectionClass('DateTime');
+$method = $class->getMethod('setTime');
+
+foreach ($method->getParameters() as $parameter) {
+ try {
+ var_dump($parameter->getDefaultValueConstantName());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+
+echo "----------\n";
+
+$class = new ReflectionClass('DateTimeZone');
+$method = $class->getMethod('getTransitions');
+
+foreach ($method->getParameters() as $parameter) {
+ try {
+ var_dump($parameter->getDefaultValueConstantName());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+
+echo "----------\n";
+
+$class = new ReflectionClass('DateTimeZone');
+$method = $class->getMethod('listIdentifiers');
+
+foreach ($method->getParameters() as $parameter) {
+ try {
+ var_dump($parameter->getDefaultValueConstantName());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+
+?>
+--EXPECT--
+Internal error: Failed to retrieve the default value
+Internal error: Failed to retrieve the default value
+NULL
+NULL
+----------
+string(11) "PHP_INT_MIN"
+string(11) "PHP_INT_MAX"
+----------
+string(17) "DateTimeZone::ALL"
+NULL
diff --git a/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValue_Internal.phpt b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValue_Internal.phpt
new file mode 100644
index 0000000000..c1e1a14b27
--- /dev/null
+++ b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_getDefaultValue_Internal.phpt
@@ -0,0 +1,37 @@
+--TEST--
+ReflectionParameter::getDefaultValue() should also work for parameters of internal functions.
+--FILE--
+<?php
+$class = new ReflectionClass('DateTime');
+$method = $class->getMethod('setTime');
+
+foreach ($method->getParameters() as $k => $parameter) {
+ try {
+ var_dump($parameter->getDefaultValue());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+
+echo "----------\n";
+
+$class = new ReflectionClass('DateTimeZone');
+$method = $class->getMethod('listIdentifiers');
+
+foreach ($method->getParameters() as $parameter) {
+ try {
+ var_dump($parameter->getDefaultValue());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+
+?>
+--EXPECT--
+Internal error: Failed to retrieve the default value
+Internal error: Failed to retrieve the default value
+int(0)
+int(0)
+----------
+int(2047)
+NULL
diff --git a/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueAvailable_Internal.phpt b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueAvailable_Internal.phpt
new file mode 100644
index 0000000000..bcdcb68f19
--- /dev/null
+++ b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueAvailable_Internal.phpt
@@ -0,0 +1,28 @@
+--TEST--
+ReflectionParameter::isDefaultValueAvailable() should also work for parameters of internal functions
+--FILE--
+<?php
+$class = new ReflectionClass('DateTime');
+$method = $class->getMethod('setTime');
+
+foreach ($method->getParameters() as $parameter) {
+ var_dump($parameter->isDefaultValueAvailable());
+}
+
+echo "----------\n";
+
+$class = new ReflectionClass('DateTimeZone');
+$method = $class->getMethod('listIdentifiers');
+
+foreach ($method->getParameters() as $parameter) {
+ var_dump($parameter->isDefaultValueAvailable());
+}
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+----------
+bool(true)
+bool(true)
diff --git a/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueConstant_Internal.phpt b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueConstant_Internal.phpt
new file mode 100644
index 0000000000..35c5548074
--- /dev/null
+++ b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_isDefaultValueConstant_Internal.phpt
@@ -0,0 +1,36 @@
+--TEST--
+ReflectionParameter::isDefaultValueConstant() should also work for parameters of internal functions
+--FILE--
+<?php
+$class = new ReflectionClass('DateTime');
+$method = $class->getMethod('setTime');
+
+foreach ($method->getParameters() as $parameter) {
+ try {
+ var_dump($parameter->isDefaultValueConstant());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+
+echo "----------\n";
+
+$class = new ReflectionClass('DateTimeZone');
+$method = $class->getMethod('listIdentifiers');
+
+foreach ($method->getParameters() as $parameter) {
+ try {
+ var_dump($parameter->isDefaultValueConstant());
+ } catch (ReflectionException $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+}
+?>
+--EXPECT--
+Internal error: Failed to retrieve the default value
+Internal error: Failed to retrieve the default value
+bool(false)
+bool(false)
+----------
+bool(true)
+bool(false)
diff --git a/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_toString_Internal.phpt b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_toString_Internal.phpt
new file mode 100644
index 0000000000..6697232869
--- /dev/null
+++ b/ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_toString_Internal.phpt
@@ -0,0 +1,28 @@
+--TEST--
+ReflectionParameter::__toString() should display default values for internal functions as well
+--FILE--
+<?php
+$class = new ReflectionClass('DateTime');
+$method = $class->getMethod('setTime');
+
+foreach ($method->getParameters() as $k => $parameter) {
+ echo $parameter . "\n";
+}
+
+echo "----------\n";
+
+$class = new ReflectionClass('DateTimeZone');
+$method = $class->getMethod('listIdentifiers');
+
+foreach ($method->getParameters() as $parameter) {
+ echo $parameter . "\n";
+}
+?>
+--EXPECT--
+Parameter #0 [ <required> int $hour ]
+Parameter #1 [ <required> int $minute ]
+Parameter #2 [ <optional> int $second = 0 ]
+Parameter #3 [ <optional> int $microseconds = 0 ]
+----------
+Parameter #0 [ <optional> int $what = DateTimeZone::ALL ]
+Parameter #1 [ <optional> ?string $country = null ]
diff --git a/ext/reflection/tests/internal_parameter_default_value/check_all.phpt b/ext/reflection/tests/internal_parameter_default_value/check_all.phpt
new file mode 100644
index 0000000000..7bfe08bc56
--- /dev/null
+++ b/ext/reflection/tests/internal_parameter_default_value/check_all.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Check that all internal parameter defaults evaluate without error
+--FILE--
+<?php
+
+function checkDefaults(ReflectionFunctionAbstract $rf) {
+ foreach ($rf->getParameters() as $param) {
+ if ($param->isDefaultValueAvailable()) {
+ try {
+ $param->getDefaultValue();
+ } catch (Error $e) {
+ echo "{$rf->getName()}: {$e->getMessage()}\n";
+ }
+ }
+ }
+}
+
+foreach (get_defined_functions()["internal"] as $func) {
+ $rf = new ReflectionFunction($func);
+ checkDefaults($rf);
+}
+
+foreach (get_declared_classes() as $class) {
+ $rc = new ReflectionClass($class);
+ foreach ($rc->getMethods() as $method) {
+ checkDefaults($method);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/reflection/tests/parameters_001.phpt b/ext/reflection/tests/parameters_001.phpt
index 972b97c1c7..6c57b2c307 100644
--- a/ext/reflection/tests/parameters_001.phpt
+++ b/ext/reflection/tests/parameters_001.phpt
@@ -4,8 +4,8 @@ ReflectionParameter Check for parameter being optional
<?php
class Test {
- function func($x, $y = NULL){
- }
+ function func($x, $y = NULL){
+ }
}
@@ -20,19 +20,17 @@ $p = new ReflectionParameter(array('Test', 'func'), 'y');
var_dump($p->isOptional());
try {
- $p = new ReflectionParameter(array('Test', 'func'), 'z');
- var_dump($p->isOptional());
+ $p = new ReflectionParameter(array('Test', 'func'), 'z');
+ var_dump($p->isOptional());
}
catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
-===DONE===
--EXPECT--
int(2)
int(1)
bool(false)
bool(true)
string(54) "The parameter specified by its name could not be found"
-===DONE===
diff --git a/ext/reflection/tests/parameters_002.phpt b/ext/reflection/tests/parameters_002.phpt
index ae924323a0..14cb7fdefb 100644
--- a/ext/reflection/tests/parameters_002.phpt
+++ b/ext/reflection/tests/parameters_002.phpt
@@ -10,61 +10,61 @@ function test($nix, Array $ar, &$ref, stdClass $std,
class test
{
- function method($nix, Array $ar, &$ref, stdClass $std,
+ function method($nix, Array $ar, &$ref, stdClass $std,
NonExistingClass $na, stdClass $opt = NULL, $def = "FooBar")
- {
- }
+ {
+ }
}
function check_params_decl_func($r, $f)
{
- $c = $r->$f();
+ $c = $r->$f();
$sep = $c instanceof ReflectionMethod ? $c->class . '::' : '';
- echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n";
+ echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n";
}
function check_params_decl_class($r, $f)
{
- $c = $r->$f();
- echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n";
+ $c = $r->$f();
+ echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n";
}
function check_params_func($r, $f)
{
- echo $f . ': ';
- $v = $r->$f();
- var_dump($v);
+ echo $f . ': ';
+ $v = $r->$f();
+ var_dump($v);
}
function check_params($r)
{
- echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n";
- $i = 0;
- foreach($r->getParameters() as $p)
- {
- echo "===" . $i . "===\n";
- $i++;
- check_params_func($p, 'getName');
- check_params_func($p, 'isPassedByReference');
- try
- {
- check_params_decl_class($p, 'getClass');
- }
- catch(ReflectionException $e)
- {
- echo $e->getMessage() . "\n";
- }
- check_params_decl_class($p, 'getDeclaringClass');
+ echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n";
+ $i = 0;
+ foreach($r->getParameters() as $p)
+ {
+ echo "===" . $i . "===\n";
+ $i++;
+ check_params_func($p, 'getName');
+ check_params_func($p, 'isPassedByReference');
+ try
+ {
+ check_params_decl_class($p, 'getClass');
+ }
+ catch(ReflectionException $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ check_params_decl_class($p, 'getDeclaringClass');
// check_params_decl_func($p, 'getDeclaringFunction');
- check_params_func($p, 'isArray');
- check_params_func($p, 'allowsNull');
- check_params_func($p, 'isOptional');
- check_params_func($p, 'isDefaultValueAvailable');
- if ($p->isOptional())
- {
- check_params_func($p, 'getDefaultValue');
- }
- }
+ check_params_func($p, 'isArray');
+ check_params_func($p, 'allowsNull');
+ check_params_func($p, 'isOptional');
+ check_params_func($p, 'isDefaultValueAvailable');
+ if ($p->isOptional())
+ {
+ check_params_func($p, 'getDefaultValue');
+ }
+ }
}
check_params(new ReflectionFunction('test'));
@@ -72,8 +72,6 @@ check_params(new ReflectionFunction('test'));
check_params(new ReflectionMethod('test::method'));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
#####test()#####
===0===
@@ -207,4 +205,3 @@ allowsNull: bool(true)
isOptional: bool(true)
isDefaultValueAvailable: bool(true)
getDefaultValue: string(6) "FooBar"
-===DONE===
diff --git a/ext/reflection/tests/property_exists.phpt b/ext/reflection/tests/property_exists.phpt
index d7ecefb775..3af7bc4ce6 100644
--- a/ext/reflection/tests/property_exists.phpt
+++ b/ext/reflection/tests/property_exists.phpt
@@ -5,54 +5,54 @@ Reflection and property_exists()
class A
{
- public $a = 1;
- protected $b = 2;
- private $c = 3;
+ public $a = 1;
+ protected $b = 2;
+ private $c = 3;
- public $empty;
- public $init = 1;
+ public $empty;
+ public $init = 1;
- function __toString()
- {
- return 'obj(' . get_class($this) . ')';
- }
+ function __toString()
+ {
+ return 'obj(' . get_class($this) . ')';
+ }
- static function test($oc, $props)
- {
- echo '===' . __CLASS__ . "===\n";
- foreach($props as $p2) {
- echo $oc, '::$' , $p2, "\n";
- var_dump(property_exists($oc, $p2));
- }
- }
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
}
class B extends A
{
- private $c = 4;
+ private $c = 4;
- static function test($oc, $props)
- {
- echo '===' . __CLASS__ . "===\n";
- foreach($props as $p2) {
- echo $oc, '::$' , $p2, "\n";
- var_dump(property_exists($oc, $p2));
- }
- }
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
}
class C extends B
{
- private $d = 5;
+ private $d = 5;
- static function test($oc, $props)
- {
- echo '===' . __CLASS__ . "===\n";
- foreach($props as $p2) {
- echo $oc, '::$' , $p2, "\n";
- var_dump(property_exists($oc, $p2));
- }
- }
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
}
$oA = new A;
@@ -64,22 +64,30 @@ $pc = array($oA, 'A', 'B', 'C', $oC);
$pr = array('a', 'b', 'c', 'd', 'e');
foreach($pc as $p1) {
- if (is_object($p1)) {
- $p1->test($p1, $pr);
- } else {
- $r = new ReflectionMethod($p1, 'test');
- $r->invoke(NULL, $p1, $pr);
- }
- echo "===GLOBAL===\n";
- foreach($pr as $p2) {
- echo $p1, '::$' , $p2, "\n";
- var_dump(property_exists($p1, $p2));
- }
+ if (is_object($p1)) {
+ $p1->test($p1, $pr);
+ } else {
+ $r = new ReflectionMethod($p1, 'test');
+ $r->invoke(NULL, $p1, $pr);
+ }
+ echo "===GLOBAL===\n";
+ foreach($pr as $p2) {
+ echo $p1, '::$' , $p2, "\n";
+ var_dump(property_exists($p1, $p2));
+ }
}
echo "===PROBLEMS===\n";
-var_dump(property_exists(NULL, 'empty'));
-var_dump(property_exists(25,'empty'));
+try {
+ var_dump(property_exists(NULL, 'empty'));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(25,'empty'));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(property_exists('',''));
var_dump(property_exists('A',''));
var_dump(property_exists('A','123'));
@@ -90,9 +98,7 @@ var_dump(property_exists(new A, '123'));
var_dump(property_exists(new A, 'init'));
var_dump(property_exists(new A, 'empty'));
?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
+--EXPECT--
===A===
obj(A)::$a
bool(true)
@@ -204,12 +210,8 @@ bool(true)
obj(C)::$e
bool(false)
===PROBLEMS===
-
-Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d
-NULL
-
-Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d
-NULL
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given
bool(false)
bool(false)
bool(false)
@@ -219,4 +221,3 @@ bool(false)
bool(false)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/request38992.phpt b/ext/reflection/tests/request38992.phpt
index 8c0052fd85..547b2d2523 100644
--- a/ext/reflection/tests/request38992.phpt
+++ b/ext/reflection/tests/request38992.phpt
@@ -11,12 +11,17 @@ class MyClass
}
$r = new ReflectionMethod('MyClass', 'doSomething');
-$r->invoke('WTF?');
-$r->invokeArgs('WTF?', array());
+try {
+ $r->invoke('WTF?');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $r->invokeArgs('WTF?', array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d
-===DONE===
+--EXPECT--
+ReflectionMethod::invoke(): Argument #1 ($object) must be of type ?object, string given
+ReflectionMethod::invokeArgs(): Argument #1 ($object) must be of type ?object, string given
diff --git a/ext/reflection/tests/static_properties_002.phpt b/ext/reflection/tests/static_properties_002.phpt
index 0e3baa9530..126aa784a0 100644
--- a/ext/reflection/tests/static_properties_002.phpt
+++ b/ext/reflection/tests/static_properties_002.phpt
@@ -4,29 +4,29 @@ Reflection and inheriting static properties
<?php
class base {
- static protected $prop = 2;
+ static protected $prop = 2;
- static function show() {
- echo __METHOD__ . '(' . self::$prop . ")\n";
- }
+ static function show() {
+ echo __METHOD__ . '(' . self::$prop . ")\n";
+ }
- static function inc() {
- base::$prop++;
- echo __METHOD__ . "()\n";
- }
+ static function inc() {
+ base::$prop++;
+ echo __METHOD__ . "()\n";
+ }
}
class derived extends base {
- static public $prop = 2;
+ static public $prop = 2;
- static function show() {
- echo __METHOD__ . '(' . self::$prop . ")\n";
- }
+ static function show() {
+ echo __METHOD__ . '(' . self::$prop . ")\n";
+ }
- static function inc() {
- derived::$prop++;
- echo __METHOD__ . "()\n";
- }
+ static function inc() {
+ derived::$prop++;
+ echo __METHOD__ . "()\n";
+ }
}
base::show();
diff --git a/ext/reflection/tests/static_type.phpt b/ext/reflection/tests/static_type.phpt
new file mode 100644
index 0000000000..b541008f79
--- /dev/null
+++ b/ext/reflection/tests/static_type.phpt
@@ -0,0 +1,22 @@
+--TEST--
+ReflectionType for static types
+--FILE--
+<?php
+
+class A {
+ public function test(): static {
+ return new static;
+ }
+}
+
+$rm = new ReflectionMethod(A::class, 'test');
+$rt = $rm->getReturnType();
+var_dump($rt->isBuiltin());
+var_dump($rt->getName());
+var_dump((string) $rt);
+
+?>
+--EXPECT--
+bool(false)
+string(6) "static"
+string(6) "static"
diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt
new file mode 100644
index 0000000000..042ba0759d
--- /dev/null
+++ b/ext/reflection/tests/union_types.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Union types in reflection
+--INI--
+error_reporting=E_ALL&~E_DEPRECATED
+--FILE--
+<?php
+
+function dumpType(ReflectionUnionType $rt) {
+ echo "Type $rt:\n";
+ echo "Allows null: " . ($rt->allowsNull() ? "true" : "false") . "\n";
+ foreach ($rt->getTypes() as $type) {
+ echo " Name: " . $type->getName() . "\n";
+ echo " String: " . (string) $type . "\n";
+ echo " Allows Null: " . ($type->allowsNull() ? "true" : "false") . "\n";
+ }
+}
+
+function test1(): X|Y|int|float|false|null { }
+function test2(): X|iterable|bool { }
+
+class Test {
+ public X|Y|int $prop;
+}
+
+dumpType((new ReflectionFunction('test1'))->getReturnType());
+dumpType((new ReflectionFunction('test2'))->getReturnType());
+
+$rc = new ReflectionClass(Test::class);
+$rp = $rc->getProperty('prop');
+dumpType($rp->getType());
+
+/* Force CE resolution of the property type */
+
+class x {}
+$test = new Test;
+$test->prop = new x;
+
+$rp = $rc->getProperty('prop');
+dumpType($rp->getType());
+
+class y {}
+$test->prop = new y;
+
+$rp = $rc->getProperty('prop');
+dumpType($rp->getType());
+
+?>
+--EXPECT--
+Type X|Y|int|float|false|null:
+Allows null: true
+ Name: X
+ String: X
+ Allows Null: false
+ Name: Y
+ String: Y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
+ Name: float
+ String: float
+ Allows Null: false
+ Name: false
+ String: false
+ Allows Null: false
+ Name: null
+ String: null
+ Allows Null: true
+Type X|iterable|bool:
+Allows null: false
+ Name: X
+ String: X
+ Allows Null: false
+ Name: iterable
+ String: iterable
+ Allows Null: false
+ Name: bool
+ String: bool
+ Allows Null: false
+Type X|Y|int:
+Allows null: false
+ Name: X
+ String: X
+ Allows Null: false
+ Name: Y
+ String: Y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
+Type x|Y|int:
+Allows null: false
+ Name: x
+ String: x
+ Allows Null: false
+ Name: Y
+ String: Y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
+Type x|y|int:
+Allows null: false
+ Name: x
+ String: x
+ Allows Null: false
+ Name: y
+ String: y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false