Skip to content

Commit 55bd88c

Browse files
committed
Remove redundant __clone() methods from Reflection
Reflection classes already use NULLed clone_obj to signal that they cannot be cloned, so it's not necessary to additionally declare a throwing __clone() method.
1 parent e7131a4 commit 55bd88c

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

ext/reflection/php_reflection.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,14 +1407,6 @@ static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS
14071407
}
14081408
/* }}} */
14091409

1410-
/* {{{ Preventing __clone from being called */
1411-
ZEND_METHOD(reflection, __clone)
1412-
{
1413-
/* Should never be executable */
1414-
_DO_THROW("Cannot clone object using __clone()");
1415-
}
1416-
/* }}} */
1417-
14181410
/* {{{ proto public static mixed Reflection::export(Reflector r [, bool return])
14191411
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
14201412
ZEND_METHOD(reflection, export)
@@ -6097,7 +6089,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0)
60976089
ZEND_END_ARG_INFO()
60986090

60996091
static const zend_function_entry reflection_function_abstract_functions[] = {
6100-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
61016092
ZEND_ME(reflection_function, inNamespace, arginfo_reflection__void, 0)
61026093
ZEND_ME(reflection_function, isClosure, arginfo_reflection__void, 0)
61036094
ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0)
@@ -6283,7 +6274,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_implementsInterface, 0)
62836274
ZEND_END_ARG_INFO()
62846275

62856276
static const zend_function_entry reflection_class_functions[] = {
6286-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
62876277
ZEND_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
62886278
ZEND_ME(reflection_class, __construct, arginfo_reflection_class___construct, 0)
62896279
ZEND_ME(reflection_class, __toString, arginfo_reflection__void, 0)
@@ -6382,7 +6372,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccessible, 0)
63826372
ZEND_END_ARG_INFO()
63836373

63846374
static const zend_function_entry reflection_property_functions[] = {
6385-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
63866375
ZEND_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
63876376
ZEND_ME(reflection_property, __construct, arginfo_reflection_property___construct, 0)
63886377
ZEND_ME(reflection_property, __toString, arginfo_reflection__void, 0)
@@ -6413,7 +6402,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant___construct, 0, 0, 2)
64136402
ZEND_END_ARG_INFO()
64146403

64156404
static const zend_function_entry reflection_class_constant_functions[] = {
6416-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
64176405
ZEND_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
64186406
ZEND_ME(reflection_class_constant, __construct, arginfo_reflection_class_constant___construct, 0)
64196407
ZEND_ME(reflection_class_constant, __toString, arginfo_reflection__void, 0)
@@ -6440,7 +6428,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_parameter___construct, 0)
64406428
ZEND_END_ARG_INFO()
64416429

64426430
static const zend_function_entry reflection_parameter_functions[] = {
6443-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
64446431
ZEND_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
64456432
ZEND_ME(reflection_parameter, __construct, arginfo_reflection_parameter___construct, 0)
64466433
ZEND_ME(reflection_parameter, __toString, arginfo_reflection__void, 0)
@@ -6466,7 +6453,6 @@ static const zend_function_entry reflection_parameter_functions[] = {
64666453
};
64676454

64686455
static const zend_function_entry reflection_type_functions[] = {
6469-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
64706456
ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0)
64716457
ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0)
64726458
/* ReflectionType::__toString() is deprecated, but we currently do not mark it as such
@@ -6491,7 +6477,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_extension___construct, 0)
64916477
ZEND_END_ARG_INFO()
64926478

64936479
static const zend_function_entry reflection_extension_functions[] = {
6494-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
64956480
ZEND_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
64966481
ZEND_ME(reflection_extension, __construct, arginfo_reflection_extension___construct, 0)
64976482
ZEND_ME(reflection_extension, __toString, arginfo_reflection__void, 0)
@@ -6514,7 +6499,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_zend_extension___construct, 0)
65146499
ZEND_END_ARG_INFO()
65156500

65166501
static const zend_function_entry reflection_zend_extension_functions[] = {
6517-
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
65186502
ZEND_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
65196503
ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0)
65206504
ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0)

ext/reflection/tests/ReflectionClass_toString_001.phpt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
3434
Property [ <default> public $name ]
3535
}
3636

37-
- Methods [53] {
38-
Method [ <internal:Reflection> final private method __clone ] {
39-
40-
- Parameters [0] {
41-
}
42-
}
43-
37+
- Methods [52] {
4438
Method [ <internal:Reflection, ctor> public method __construct ] {
4539

4640
- Parameters [1] {

0 commit comments

Comments
 (0)