From 3121b7174f4cb077b1165bf4feed1ec889472f1e Mon Sep 17 00:00:00 2001 From: Nikita Popov <nikita.ppv@gmail.com> Date: Thu, 11 Jul 2019 13:41:10 +0200 Subject: [PATCH] Deprecate Reflection export() methods And remove the Reflector::export() interface method. --- Zend/tests/bug43200.phpt | 2 +- Zend/tests/return_types/reflection001.phpt | 2 +- ext/reflection/php_reflection.c | 21 +++++++++---------- ext/reflection/tests/009.phpt | 4 +--- ext/reflection/tests/025.phpt | 4 +--- .../tests/ReflectionClassConstant_basic1.phpt | 16 ++++++++++++++ ...ReflectionClass_export_array_bug72222.phpt | 4 ++-- .../tests/ReflectionClass_export_basic1.phpt | 4 ++-- .../tests/ReflectionClass_export_basic2.phpt | 6 +++--- .../tests/ReflectionClass_toString_001.phpt | 2 +- .../ReflectionExtension_export_basic.phpt | 8 ++----- .../tests/ReflectionMethod_basic2.phpt | 16 ++++++++++++++ .../tests/ReflectionObject_export_basic1.phpt | 4 ++-- .../tests/ReflectionObject_export_basic2.phpt | 4 ++-- .../tests/ReflectionObject_export_basic3.phpt | 4 ++-- .../ReflectionParameter_export_basic.phpt | 6 +++--- .../ReflectionParameter_export_error2.phpt | 5 ++++- .../ReflectionParameter_export_error3.phpt | 8 ++++--- .../tests/ReflectionProperty_basic1.phpt | 18 +++++++++++++++- .../ReflectionProperty_export_basic.phpt | 6 ++---- .../ReflectionProperty_export_error.phpt | 10 +++++++++ .../tests/ReflectionZendExtension.phpt | 4 +++- ext/reflection/tests/bug29986.phpt | 2 +- ext/reflection/tests/bug33389.phpt | 7 +------ ext/reflection/tests/bug37964.phpt | 2 +- ext/reflection/tests/bug38942.phpt | 2 +- ext/reflection/tests/bug41061.phpt | 6 +++--- ext/reflection/tests/bug45571.phpt | 4 ++-- ext/reflection/tests/bug45765.phpt | 2 +- ext/reflection/tests/bug46205.phpt | 3 ++- ext/reflection/tests/traits002.phpt | 4 ++-- ext/simplexml/tests/bug37565.phpt | 2 ++ ext/spl/tests/countable_class_basic1.phpt | 2 +- ext/standard/tests/strings/bug61116.phpt | 4 ++-- 34 files changed, 125 insertions(+), 73 deletions(-) diff --git a/Zend/tests/bug43200.phpt b/Zend/tests/bug43200.phpt index 35b96b1ba1..be94a64531 100644 --- a/Zend/tests/bug43200.phpt +++ b/Zend/tests/bug43200.phpt @@ -19,7 +19,7 @@ class x extends c implements a, b { function foo() { } } -ReflectionClass::export('x'); +echo new ReflectionClass('x'); ?> --EXPECTF-- diff --git a/Zend/tests/return_types/reflection001.phpt b/Zend/tests/return_types/reflection001.phpt index c2ff253cdb..dabadf6f06 100644 --- a/Zend/tests/return_types/reflection001.phpt +++ b/Zend/tests/return_types/reflection001.phpt @@ -9,7 +9,7 @@ class A { } } -ReflectionClass::export("A"); +echo new ReflectionClass("A"); ?> --EXPECTF-- Class [ <user> class A ] { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a2e38bf3f3..eafe62344b 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -6262,12 +6262,11 @@ 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_ME(reflection, export, arginfo_reflection_export, 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_FENTRY(export, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) ZEND_ABSTRACT_ME(reflector, __toString, arginfo_reflection__void) PHP_FE_END }; @@ -6322,7 +6321,7 @@ static const zend_function_entry reflection_function_abstract_functions[] = { 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_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6379,7 +6378,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_getClosure, 0) ZEND_END_ARG_INFO() static const zend_function_entry reflection_method_functions[] = { - ZEND_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6477,7 +6476,7 @@ 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_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6544,7 +6543,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_reflection_object___construct, 0) ZEND_END_ARG_INFO() static const zend_function_entry reflection_object_functions[] = { - ZEND_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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 }; @@ -6580,7 +6579,7 @@ 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_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6614,7 +6613,7 @@ 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_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6641,7 +6640,7 @@ 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_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6689,7 +6688,7 @@ 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_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) @@ -6712,7 +6711,7 @@ 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_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + 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) diff --git a/ext/reflection/tests/009.phpt b/ext/reflection/tests/009.phpt index 09df90c8c3..d582623cbd 100644 --- a/ext/reflection/tests/009.phpt +++ b/ext/reflection/tests/009.phpt @@ -14,7 +14,7 @@ function test ($a, $b = 1, $c = "") { $func = new ReflectionFunction("test"); -var_dump($func->export("test")); +echo $func; echo "--getName--\n"; var_dump($func->getName()); echo "--isInternal--\n"; @@ -60,8 +60,6 @@ Function [ <user> function test ] { Parameter #2 [ <optional> $c = '' ] } } - -NULL --getName-- string(4) "test" --isInternal-- diff --git a/ext/reflection/tests/025.phpt b/ext/reflection/tests/025.phpt index f1e13d9240..c18a0f5b8e 100644 --- a/ext/reflection/tests/025.phpt +++ b/ext/reflection/tests/025.phpt @@ -14,7 +14,7 @@ function test ($a, $b = 1, $c = "") { $func = new ReflectionFunction("test"); -var_dump($func->export("test")); +echo $func; echo "--getName--\n"; var_dump($func->getName()); echo "--isInternal--\n"; @@ -60,8 +60,6 @@ Function [ <user> function test ] { Parameter #2 [ <optional> $c = '' ] } } - -NULL --getName-- string(4) "test" --isInternal-- diff --git a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt index 78510d0b35..181360d733 100644 --- a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt +++ b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt @@ -56,9 +56,13 @@ __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 @@ -90,9 +94,13 @@ __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 @@ -124,9 +132,13 @@ __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 @@ -158,9 +170,13 @@ __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 diff --git a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt index 30694bf536..80d2be2585 100644 --- a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt +++ b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt @@ -1,12 +1,12 @@ --TEST-- -ReflectionClass::export() - array constants +ReflectionClass::__toString() - array constants --FILE-- <?php Class A { const A = 8; const B = ["a", "b"]; } -ReflectionClass::export("A"); +echo new ReflectionClass("A"), "\n"; ?> --EXPECTF-- Class [ <user> class A ] { diff --git a/ext/reflection/tests/ReflectionClass_export_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt index abfa41f3d7..d9183442c4 100644 --- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt +++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionClass::export() - various parameters +ReflectionClass::__toString() - various parameters --FILE-- <?php Class A { @@ -17,7 +17,7 @@ Class A { Class C extends A { } define('K', "16 chars long --"); -ReflectionClass::export("C"); +echo new ReflectionClass("C"), "\n"; ?> --EXPECTF-- Class [ <user> class C extends A ] { diff --git a/ext/reflection/tests/ReflectionClass_export_basic2.phpt b/ext/reflection/tests/ReflectionClass_export_basic2.phpt index 5699529b3d..12cee4e6e3 100644 --- a/ext/reflection/tests/ReflectionClass_export_basic2.phpt +++ b/ext/reflection/tests/ReflectionClass_export_basic2.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionClass::export() - ensure inherited private props are hidden. +ReflectionClass::__toString() - ensure inherited private props are hidden. --FILE-- <?php Class c { @@ -9,8 +9,8 @@ Class c { class d extends c {} -ReflectionClass::export("c"); -ReflectionClass::export("d"); +echo new ReflectionClass("c"), "\n"; +echo new ReflectionClass("d"), "\n"; ?> --EXPECTF-- Class [ <user> class c ] { diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt index e97af14110..2cfd808cb8 100644 --- a/ext/reflection/tests/ReflectionClass_toString_001.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt @@ -21,7 +21,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] { } - Static methods [1] { - Method [ <internal:Reflection, prototype Reflector> static public method export ] { + Method [ <internal, deprecated:Reflection> static public method export ] { - Parameters [2] { Parameter #0 [ <required> $argument ] diff --git a/ext/reflection/tests/ReflectionExtension_export_basic.phpt b/ext/reflection/tests/ReflectionExtension_export_basic.phpt index 3fa7a66afd..4652a409a1 100644 --- a/ext/reflection/tests/ReflectionExtension_export_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_export_basic.phpt @@ -5,18 +5,14 @@ Gerrit "Remi" te Sligte <remi@wolerized.com> Leon Luijkx <leon@phpgg.nl> --FILE-- <?php -ob_start(); ReflectionExtension::export("reflection", true); -$test = ob_get_clean(); -var_dump(empty($test)); -unset($test); ob_start(); ReflectionExtension::export("reflection", false); $test = ob_get_clean(); var_dump(empty($test)); ?> ==DONE== ---EXPECT-- -bool(true) +--EXPECTF-- +Deprecated: Function ReflectionExtension::export() is deprecated in %s on line %d bool(false) ==DONE== diff --git a/ext/reflection/tests/ReflectionMethod_basic2.phpt b/ext/reflection/tests/ReflectionMethod_basic2.phpt index c91af67701..71ef9e95d9 100644 --- a/ext/reflection/tests/ReflectionMethod_basic2.phpt +++ b/ext/reflection/tests/ReflectionMethod_basic2.phpt @@ -60,6 +60,8 @@ string(%d) "Method [ <user, inherits TestClass> public method foo ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user, inherits TestClass> public method foo ] { @@ %s 16 - 18 } @@ -76,6 +78,8 @@ string(%d) "Method [ <user> static public method stat ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user> static public method stat ] { @@ %s 20 - 22 } @@ -92,6 +96,8 @@ string(%d) "Method [ <user> private method priv ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user> private method priv ] { @@ %s 24 - 26 } @@ -108,6 +114,8 @@ string(%d) "Method [ <user> protected method prot ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user> protected method prot ] { @@ %s 28 - 28 } @@ -124,6 +132,8 @@ string(%d) "Method [ <user, inherits TestClass> protected method prot ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user, inherits TestClass> protected method prot ] { @@ %s 28 - 28 } @@ -140,6 +150,8 @@ string(%d) "Method [ <user> abstract public method int ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user> abstract public method int ] { @@ %s 36 - 36 } @@ -160,6 +172,8 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] { - Parameters [2] { @@ -180,6 +194,8 @@ string(%d) "Method [ <user, dtor> public method __destruct ] { " export(): + +Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d string(%d) "Method [ <user, dtor> public method __destruct ] { @@ %s 30 - 30 } diff --git a/ext/reflection/tests/ReflectionObject_export_basic1.phpt b/ext/reflection/tests/ReflectionObject_export_basic1.phpt index 2fbe6fd779..43210ea686 100644 --- a/ext/reflection/tests/ReflectionObject_export_basic1.phpt +++ b/ext/reflection/tests/ReflectionObject_export_basic1.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionObject::export() : very basic test with no dynamic properties +ReflectionObject::__toString() : very basic test with no dynamic properties --FILE-- <?php @@ -8,7 +8,7 @@ class Foo { } $f = new foo; -ReflectionObject::export($f); +echo new ReflectionObject($f); ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionObject_export_basic2.phpt b/ext/reflection/tests/ReflectionObject_export_basic2.phpt index 652a5556cd..970d07b432 100644 --- a/ext/reflection/tests/ReflectionObject_export_basic2.phpt +++ b/ext/reflection/tests/ReflectionObject_export_basic2.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionObject::export() : very basic test with dynamic properties +ReflectionObject::__toString() : very basic test with dynamic properties --FILE-- <?php @@ -9,7 +9,7 @@ class Foo { $f = new foo; $f->dynProp = 'hello'; $f->dynProp2 = 'hello again'; -ReflectionObject::export($f); +echo new ReflectionObject($f); ?> --EXPECTF-- diff --git a/ext/reflection/tests/ReflectionObject_export_basic3.phpt b/ext/reflection/tests/ReflectionObject_export_basic3.phpt index c4afc22d64..a92c2d4921 100644 --- a/ext/reflection/tests/ReflectionObject_export_basic3.phpt +++ b/ext/reflection/tests/ReflectionObject_export_basic3.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionObject::export() - ensure dynamic property with same name as inherited private property is shown. +ReflectionObject::__toString() - ensure dynamic property with same name as inherited private property is shown. --FILE-- <?php class C { @@ -11,7 +11,7 @@ class D extends C{ $Obj = new D; $Obj->p = 'value'; -ReflectionObject::export($Obj) +echo new ReflectionObject($Obj); ?> --EXPECTF-- Object of class [ <user> class D extends C ] { diff --git a/ext/reflection/tests/ReflectionParameter_export_basic.phpt b/ext/reflection/tests/ReflectionParameter_export_basic.phpt index 74428ccd23..6f3d16a5ff 100644 --- a/ext/reflection/tests/ReflectionParameter_export_basic.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionParameter::export() +ReflectionParameter::__toString() --CREDITS-- Stefan Koopmanschap <stefan@stefankoopmanschap.nl> --FILE-- @@ -9,11 +9,11 @@ function ReflectionParameterTest($test, $test2 = null) { } $reflect = new ReflectionFunction('ReflectionParameterTest'); foreach($reflect->getParameters() as $key => $value) { - echo ReflectionParameter::export('ReflectionParameterTest', $key); + echo new ReflectionParameter('ReflectionParameterTest', $key), "\n"; } ?> ==DONE== ---EXPECT-- +--EXPECTF-- 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 index aa0bc0aa7c..38cd99171b 100644 --- a/ext/reflection/tests/ReflectionParameter_export_error2.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_error2.phpt @@ -26,6 +26,9 @@ catch (ReflectionException $e) { echo $e->getMessage() . "\n"; } ?> ---EXPECT-- +--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 index f5223c35fe..b098a9251d 100644 --- a/ext/reflection/tests/ReflectionParameter_export_error3.phpt +++ b/ext/reflection/tests/ReflectionParameter_export_error3.phpt @@ -13,9 +13,11 @@ foreach($params as $key => $value) { ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter'); } --EXPECTF-- -Fatal error: Uncaught ReflectionException: The parameter specified by its name could not be found in %s.php:%d +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.php(%d): ReflectionParameter::export('ReflectionParam...', 'incorrect_param...') +#1 %s(%d): ReflectionParameter::export('ReflectionParam...', 'incorrect_param...') #2 {main} - thrown in %s.php on line %d + thrown in %s on line %d diff --git a/ext/reflection/tests/ReflectionProperty_basic1.phpt b/ext/reflection/tests/ReflectionProperty_basic1.phpt index 18eb71fa10..1748ebfca9 100644 --- a/ext/reflection/tests/ReflectionProperty_basic1.phpt +++ b/ext/reflection/tests/ReflectionProperty_basic1.phpt @@ -47,7 +47,7 @@ reflectProperty("TestClass", "prot"); reflectProperty("TestClass", "priv"); ?> ---EXPECT-- +--EXPECTF-- ********************************** Reflecting on property TestClass::pub @@ -55,9 +55,13 @@ __toString(): string(35) "Property [ <default> public $pub ] " 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 @@ -84,9 +88,13 @@ __toString(): string(33) "Property [ public static $stat ] " 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 @@ -113,9 +121,13 @@ __toString(): string(39) "Property [ <default> protected $prot ] " 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 @@ -138,9 +150,13 @@ __toString(): string(37) "Property [ <default> private $priv ] " 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 diff --git a/ext/reflection/tests/ReflectionProperty_export_basic.phpt b/ext/reflection/tests/ReflectionProperty_export_basic.phpt index e77a3b714a..28f1f6b988 100644 --- a/ext/reflection/tests/ReflectionProperty_export_basic.phpt +++ b/ext/reflection/tests/ReflectionProperty_export_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -Test ReflectionProperty::export() usage. +Test ReflectionProperty::__toString() usage. --FILE-- <?php @@ -7,10 +7,8 @@ class TestClass { public $proper = 5; } -var_dump(ReflectionProperty::export('TestClass', 'proper')); +echo new ReflectionProperty('TestClass', 'proper'); ?> --EXPECT-- Property [ <default> public $proper ] - -NULL diff --git a/ext/reflection/tests/ReflectionProperty_export_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt index ab09ed01f0..114b4c0ac8 100644 --- a/ext/reflection/tests/ReflectionProperty_export_error.phpt +++ b/ext/reflection/tests/ReflectionProperty_export_error.phpt @@ -39,16 +39,26 @@ 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/ReflectionZendExtension.phpt b/ext/reflection/tests/ReflectionZendExtension.phpt index e11087cbf2..bce34f5a2c 100644 --- a/ext/reflection/tests/ReflectionZendExtension.phpt +++ b/ext/reflection/tests/ReflectionZendExtension.phpt @@ -14,10 +14,12 @@ var_dump($reflection->getURL()); var_dump($reflection->getVersion() === PHP_VERSION); var_dump(gettype($reflection->export('Zend OPcache', true)) === 'string'); ?> ---EXPECT-- +--EXPECTF-- string(17) "Zend Technologies" 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/bug29986.phpt b/ext/reflection/tests/bug29986.phpt index 3d8d6ee7c5..97aafd3820 100644 --- a/ext/reflection/tests/bug29986.phpt +++ b/ext/reflection/tests/bug29986.phpt @@ -13,7 +13,7 @@ class just_constants const FLOAT_CONSTANT = 3.14159265; } -Reflection::export(new ReflectionClass('just_constants')); +echo new ReflectionClass('just_constants'); ?> --EXPECTF-- Class [ <user> class just_constants ] { diff --git a/ext/reflection/tests/bug33389.phpt b/ext/reflection/tests/bug33389.phpt index f1997a397c..fb166c16ba 100644 --- a/ext/reflection/tests/bug33389.phpt +++ b/ext/reflection/tests/bug33389.phpt @@ -19,10 +19,7 @@ class Test { function foo() { } } -Reflection::export(new ReflectionClass('Test')); -?> -===DONE=== -<?php exit(0); ?> +echo new ReflectionClass('Test'); --EXPECTF-- Class [ <user> class Test ] { @@ %sbug33389.php 3-18 @@ -93,5 +90,3 @@ Class [ <user> class Test ] { } } } - -===DONE=== diff --git a/ext/reflection/tests/bug37964.phpt b/ext/reflection/tests/bug37964.phpt index f3c161da8d..f3ebe9f72a 100644 --- a/ext/reflection/tests/bug37964.phpt +++ b/ext/reflection/tests/bug37964.phpt @@ -19,7 +19,7 @@ class bar extends foo { } } -Reflection::export(new ReflectionClass(new bar)); +echo new ReflectionClass(new bar); ?> --EXPECTF-- diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt index 59666607cb..6dbe396ae6 100644 --- a/ext/reflection/tests/bug38942.phpt +++ b/ext/reflection/tests/bug38942.phpt @@ -8,7 +8,7 @@ class foo { class bar extends foo { } -ReflectionClass::export("bar"); +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 diff --git a/ext/reflection/tests/bug41061.phpt b/ext/reflection/tests/bug41061.phpt index d907907dcf..027b872be9 100644 --- a/ext/reflection/tests/bug41061.phpt +++ b/ext/reflection/tests/bug41061.phpt @@ -1,5 +1,5 @@ --TEST-- -Reflection Bug #41061 ("visibility error" in ReflectionFunction::export()) +Reflection Bug #41061 ("visibility error" in ReflectionFunction::__toString()) --FILE-- <?php @@ -11,8 +11,8 @@ class bar { } } -Reflection::export(new ReflectionFunction('foo')); -Reflection::export(new ReflectionMethod('bar', 'foo')); +echo new ReflectionFunction('foo'), "\n"; +echo new ReflectionMethod('bar', 'foo'), "\n"; ?> ===DONE=== <?php exit(0); ?> diff --git a/ext/reflection/tests/bug45571.phpt b/ext/reflection/tests/bug45571.phpt index 2aa5698879..74245fc24c 100644 --- a/ext/reflection/tests/bug45571.phpt +++ b/ext/reflection/tests/bug45571.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #45571 (ReflectionClass::export() shows superclasses' private static methods.) +Bug #45571 (ReflectionClass::__toString() shows superclasses' private static methods.) --FILE-- <?php @@ -14,7 +14,7 @@ Class A { Class C extends A { } -ReflectionClass::export("C"); +echo new ReflectionClass("C"); ?> --EXPECTF-- diff --git a/ext/reflection/tests/bug45765.phpt b/ext/reflection/tests/bug45765.phpt index 80cb39d0ac..5c33faca2b 100644 --- a/ext/reflection/tests/bug45765.phpt +++ b/ext/reflection/tests/bug45765.phpt @@ -23,7 +23,7 @@ class foo extends foo2 { } } -ReflectionObject::export(new foo); +echo new ReflectionObject(new foo); ?> --EXPECTF-- diff --git a/ext/reflection/tests/bug46205.phpt b/ext/reflection/tests/bug46205.phpt index ef7a692cb7..5ca8ac1cd0 100644 --- a/ext/reflection/tests/bug46205.phpt +++ b/ext/reflection/tests/bug46205.phpt @@ -10,5 +10,6 @@ try { } catch (Exception $e) { } ?> ok ---EXPECT-- +--EXPECTF-- +Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d ok diff --git a/ext/reflection/tests/traits002.phpt b/ext/reflection/tests/traits002.phpt index 3a4b294961..c7a09bfb19 100644 --- a/ext/reflection/tests/traits002.phpt +++ b/ext/reflection/tests/traits002.phpt @@ -10,8 +10,8 @@ trait bar { } -reflectionclass::export('foo'); -reflectionclass::export('bar'); +echo new ReflectionClass('foo'), "\n"; +echo new ReflectionClass('bar'), "\n"; ?> --EXPECTF-- diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt index 0af93deaf3..41e42cb907 100644 --- a/ext/simplexml/tests/bug37565.phpt +++ b/ext/simplexml/tests/bug37565.phpt @@ -31,7 +31,9 @@ try { ===DONE=== --EXPECT-- Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given +Error: Function Reflection::export() is deprecated Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given +Error: Function Reflection::export() is deprecated Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given ===DONE=== diff --git a/ext/spl/tests/countable_class_basic1.phpt b/ext/spl/tests/countable_class_basic1.phpt index 3108cb1818..ede42e960f 100644 --- a/ext/spl/tests/countable_class_basic1.phpt +++ b/ext/spl/tests/countable_class_basic1.phpt @@ -2,7 +2,7 @@ SPL: Test shape of interface Countable. --FILE-- <?php -ReflectionClass::export('Countable'); +echo new ReflectionClass('Countable'); ?> --EXPECTF-- Interface [ <internal%s> interface Countable ] { diff --git a/ext/standard/tests/strings/bug61116.phpt b/ext/standard/tests/strings/bug61116.phpt index 24dd0e2750..b9b38a7bbb 100644 --- a/ext/standard/tests/strings/bug61116.phpt +++ b/ext/standard/tests/strings/bug61116.phpt @@ -2,8 +2,8 @@ Bug #61116 (HTML functions use encoding, not charset) --FILE-- <?php -Reflection::export(new ReflectionFunction('htmlspecialchars')); -Reflection::export(new ReflectionFunction('get_html_translation_table')); +echo new ReflectionFunction('htmlspecialchars'), "\n"; +echo new ReflectionFunction('get_html_translation_table'), "\n"; ?> --EXPECT-- Function [ <internal:standard> function htmlspecialchars ] { -- 2.40.0