Skip to content

Commit 3121b71

Browse files
committed
Deprecate Reflection export() methods
And remove the Reflector::export() interface method.
1 parent 0ba7c3e commit 3121b71

34 files changed

+125
-73
lines changed

Zend/tests/bug43200.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class x extends c implements a, b {
1919
function foo() { }
2020
}
2121

22-
ReflectionClass::export('x');
22+
echo new ReflectionClass('x');
2323

2424
?>
2525
--EXPECTF--

Zend/tests/return_types/reflection001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class A {
99
}
1010
}
1111

12-
ReflectionClass::export("A");
12+
echo new ReflectionClass("A");
1313
?>
1414
--EXPECTF--
1515
Class [ <user> class A ] {

ext/reflection/php_reflection.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6262,12 +6262,11 @@ ZEND_END_ARG_INFO()
62626262

62636263
static const zend_function_entry reflection_functions[] = {
62646264
ZEND_ME(reflection, getModifierNames, arginfo_reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
6265-
ZEND_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
6265+
ZEND_DEP_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
62666266
PHP_FE_END
62676267
};
62686268

62696269
static const zend_function_entry reflector_functions[] = {
6270-
ZEND_FENTRY(export, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)
62716270
ZEND_ABSTRACT_ME(reflector, __toString, arginfo_reflection__void)
62726271
PHP_FE_END
62736272
};
@@ -6322,7 +6321,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = {
63226321
static const zend_function_entry reflection_function_functions[] = {
63236322
ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0)
63246323
ZEND_ME(reflection_function, __toString, arginfo_reflection__void, 0)
6325-
ZEND_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6324+
ZEND_DEP_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
63266325
ZEND_ME(reflection_function, isDisabled, arginfo_reflection__void, 0)
63276326
ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0)
63286327
ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0)
@@ -6379,7 +6378,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_getClosure, 0)
63796378
ZEND_END_ARG_INFO()
63806379

63816380
static const zend_function_entry reflection_method_functions[] = {
6382-
ZEND_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6381+
ZEND_DEP_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
63836382
ZEND_ME(reflection_method, __construct, arginfo_reflection_method___construct, 0)
63846383
ZEND_ME(reflection_method, __toString, arginfo_reflection__void, 0)
63856384
ZEND_ME(reflection_method, isPublic, arginfo_reflection__void, 0)
@@ -6477,7 +6476,7 @@ ZEND_END_ARG_INFO()
64776476

64786477
static const zend_function_entry reflection_class_functions[] = {
64796478
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
6480-
ZEND_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6479+
ZEND_DEP_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
64816480
ZEND_ME(reflection_class, __construct, arginfo_reflection_class___construct, 0)
64826481
ZEND_ME(reflection_class, __toString, arginfo_reflection__void, 0)
64836482
ZEND_ME(reflection_class, getName, arginfo_reflection__void, 0)
@@ -6544,7 +6543,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_object___construct, 0)
65446543
ZEND_END_ARG_INFO()
65456544

65466545
static const zend_function_entry reflection_object_functions[] = {
6547-
ZEND_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6546+
ZEND_DEP_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
65486547
ZEND_ME(reflection_object, __construct, arginfo_reflection_object___construct, 0)
65496548
PHP_FE_END
65506549
};
@@ -6580,7 +6579,7 @@ ZEND_END_ARG_INFO()
65806579

65816580
static const zend_function_entry reflection_property_functions[] = {
65826581
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
6583-
ZEND_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6582+
ZEND_DEP_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
65846583
ZEND_ME(reflection_property, __construct, arginfo_reflection_property___construct, 0)
65856584
ZEND_ME(reflection_property, __toString, arginfo_reflection__void, 0)
65866585
ZEND_ME(reflection_property, getName, arginfo_reflection__void, 0)
@@ -6614,7 +6613,7 @@ ZEND_END_ARG_INFO()
66146613

66156614
static const zend_function_entry reflection_class_constant_functions[] = {
66166615
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
6617-
ZEND_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6616+
ZEND_DEP_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
66186617
ZEND_ME(reflection_class_constant, __construct, arginfo_reflection_class_constant___construct, 0)
66196618
ZEND_ME(reflection_class_constant, __toString, arginfo_reflection__void, 0)
66206619
ZEND_ME(reflection_class_constant, getName, arginfo_reflection__void, 0)
@@ -6641,7 +6640,7 @@ ZEND_END_ARG_INFO()
66416640

66426641
static const zend_function_entry reflection_parameter_functions[] = {
66436642
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
6644-
ZEND_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6643+
ZEND_DEP_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
66456644
ZEND_ME(reflection_parameter, __construct, arginfo_reflection_parameter___construct, 0)
66466645
ZEND_ME(reflection_parameter, __toString, arginfo_reflection__void, 0)
66476646
ZEND_ME(reflection_parameter, getName, arginfo_reflection__void, 0)
@@ -6689,7 +6688,7 @@ ZEND_END_ARG_INFO()
66896688

66906689
static const zend_function_entry reflection_extension_functions[] = {
66916690
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
6692-
ZEND_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6691+
ZEND_DEP_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
66936692
ZEND_ME(reflection_extension, __construct, arginfo_reflection_extension___construct, 0)
66946693
ZEND_ME(reflection_extension, __toString, arginfo_reflection__void, 0)
66956694
ZEND_ME(reflection_extension, getName, arginfo_reflection__void, 0)
@@ -6712,7 +6711,7 @@ ZEND_END_ARG_INFO()
67126711

67136712
static const zend_function_entry reflection_zend_extension_functions[] = {
67146713
ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
6715-
ZEND_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
6714+
ZEND_DEP_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
67166715
ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0)
67176716
ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0)
67186717
ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0)

ext/reflection/tests/009.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function test ($a, $b = 1, $c = "") {
1414

1515
$func = new ReflectionFunction("test");
1616

17-
var_dump($func->export("test"));
17+
echo $func;
1818
echo "--getName--\n";
1919
var_dump($func->getName());
2020
echo "--isInternal--\n";
@@ -60,8 +60,6 @@ Function [ <user> function test ] {
6060
Parameter #2 [ <optional> $c = '' ]
6161
}
6262
}
63-
64-
NULL
6563
--getName--
6664
string(4) "test"
6765
--isInternal--

ext/reflection/tests/025.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function test ($a, $b = 1, $c = "") {
1414

1515
$func = new ReflectionFunction("test");
1616

17-
var_dump($func->export("test"));
17+
echo $func;
1818
echo "--getName--\n";
1919
var_dump($func->getName());
2020
echo "--isInternal--\n";
@@ -60,8 +60,6 @@ Function [ <user> function test ] {
6060
Parameter #2 [ <optional> $c = '' ]
6161
}
6262
}
63-
64-
NULL
6563
--getName--
6664
string(4) "test"
6765
--isInternal--

ext/reflection/tests/ReflectionClassConstant_basic1.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ __toString():
5656
string(35) "Constant [ public bool PUB ] { 1 }
5757
"
5858
export():
59+
60+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
5961
string(35) "Constant [ public bool PUB ] { 1 }
6062
"
6163
export():
64+
65+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
6266
Constant [ public bool PUB ] { 1 }
6367

6468
NULL
@@ -90,9 +94,13 @@ __toString():
9094
string(38) "Constant [ protected int PROT ] { 4 }
9195
"
9296
export():
97+
98+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
9399
string(38) "Constant [ protected int PROT ] { 4 }
94100
"
95101
export():
102+
103+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
96104
Constant [ protected int PROT ] { 4 }
97105

98106
NULL
@@ -124,9 +132,13 @@ __toString():
124132
string(45) "Constant [ private string PRIV ] { keepOut }
125133
"
126134
export():
135+
136+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
127137
string(45) "Constant [ private string PRIV ] { keepOut }
128138
"
129139
export():
140+
141+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
130142
Constant [ private string PRIV ] { keepOut }
131143

132144
NULL
@@ -158,9 +170,13 @@ __toString():
158170
string(45) "Constant [ private string PRIV ] { keepOut }
159171
"
160172
export():
173+
174+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
161175
string(45) "Constant [ private string PRIV ] { keepOut }
162176
"
163177
export():
178+
179+
Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
164180
Constant [ private string PRIV ] { keepOut }
165181

166182
NULL

ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
--TEST--
2-
ReflectionClass::export() - array constants
2+
ReflectionClass::__toString() - array constants
33
--FILE--
44
<?php
55
Class A {
66
const A = 8;
77
const B = ["a", "b"];
88
}
9-
ReflectionClass::export("A");
9+
echo new ReflectionClass("A"), "\n";
1010
?>
1111
--EXPECTF--
1212
Class [ <user> class A ] {

ext/reflection/tests/ReflectionClass_export_basic1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
ReflectionClass::export() - various parameters
2+
ReflectionClass::__toString() - various parameters
33
--FILE--
44
<?php
55
Class A {
@@ -17,7 +17,7 @@ Class A {
1717
Class C extends A { }
1818

1919
define('K', "16 chars long --");
20-
ReflectionClass::export("C");
20+
echo new ReflectionClass("C"), "\n";
2121
?>
2222
--EXPECTF--
2323
Class [ <user> class C extends A ] {

ext/reflection/tests/ReflectionClass_export_basic2.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
ReflectionClass::export() - ensure inherited private props are hidden.
2+
ReflectionClass::__toString() - ensure inherited private props are hidden.
33
--FILE--
44
<?php
55
Class c {
@@ -9,8 +9,8 @@ Class c {
99

1010
class d extends c {}
1111

12-
ReflectionClass::export("c");
13-
ReflectionClass::export("d");
12+
echo new ReflectionClass("c"), "\n";
13+
echo new ReflectionClass("d"), "\n";
1414
?>
1515
--EXPECTF--
1616
Class [ <user> class c ] {

ext/reflection/tests/ReflectionClass_toString_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
2121
}
2222

2323
- Static methods [1] {
24-
Method [ <internal:Reflection, prototype Reflector> static public method export ] {
24+
Method [ <internal, deprecated:Reflection> static public method export ] {
2525

2626
- Parameters [2] {
2727
Parameter #0 [ <required> $argument ]

0 commit comments

Comments
 (0)