And remove the Reflector::export() interface method.
function foo() { }
}
-ReflectionClass::export('x');
+echo new ReflectionClass('x');
?>
--EXPECTF--
}
}
-ReflectionClass::export("A");
+echo new ReflectionClass("A");
?>
--EXPECTF--
Class [ <user> class A ] {
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
};
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)
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)
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)
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
};
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)
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)
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)
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)
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)
$func = new ReflectionFunction("test");
-var_dump($func->export("test"));
+echo $func;
echo "--getName--\n";
var_dump($func->getName());
echo "--isInternal--\n";
Parameter #2 [ <optional> $c = '' ]
}
}
-
-NULL
--getName--
string(4) "test"
--isInternal--
$func = new ReflectionFunction("test");
-var_dump($func->export("test"));
+echo $func;
echo "--getName--\n";
var_dump($func->getName());
echo "--isInternal--\n";
Parameter #2 [ <optional> $c = '' ]
}
}
-
-NULL
--getName--
string(4) "test"
--isInternal--
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
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
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
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
--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 ] {
--TEST--
-ReflectionClass::export() - various parameters
+ReflectionClass::__toString() - various parameters
--FILE--
<?php
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 ] {
--TEST--
-ReflectionClass::export() - ensure inherited private props are hidden.
+ReflectionClass::__toString() - ensure inherited private props are hidden.
--FILE--
<?php
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 ] {
}
- 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 ]
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==
"
export():
+
+Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
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> static public method stat ] {
@@ %s 20 - 22
}
"
export():
+
+Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
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> 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
}
"
export():
+
+Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
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 [ <internal:Reflection, ctor> public method __construct ] {
- Parameters [2] {
"
export():
+
+Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
string(%d) "Method [ <user, dtor> public method __destruct ] {
@@ %s 30 - 30
}
--TEST--
-ReflectionObject::export() : very basic test with no dynamic properties
+ReflectionObject::__toString() : very basic test with no dynamic properties
--FILE--
<?php
}
$f = new foo;
-ReflectionObject::export($f);
+echo new ReflectionObject($f);
?>
--EXPECTF--
--TEST--
-ReflectionObject::export() : very basic test with dynamic properties
+ReflectionObject::__toString() : very basic test with dynamic properties
--FILE--
<?php
$f = new foo;
$f->dynProp = 'hello';
$f->dynProp2 = 'hello again';
-ReflectionObject::export($f);
+echo new ReflectionObject($f);
?>
--EXPECTF--
--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 {
$Obj = new D;
$Obj->p = 'value';
-ReflectionObject::export($Obj)
+echo new ReflectionObject($Obj);
?>
--EXPECTF--
Object of class [ <user> class D extends C ] {
--TEST--
-ReflectionParameter::export()
+ReflectionParameter::__toString()
--CREDITS--
Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
}
$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==
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
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
reflectProperty("TestClass", "priv");
?>
---EXPECT--
+--EXPECTF--
**********************************
Reflecting on property TestClass::pub
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
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
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
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
--TEST--
-Test ReflectionProperty::export() usage.
+Test ReflectionProperty::__toString() usage.
--FILE--
<?php
public $proper = 5;
}
-var_dump(ReflectionProperty::export('TestClass', 'proper'));
+echo new ReflectionProperty('TestClass', 'proper');
?>
--EXPECT--
Property [ <default> public $proper ]
-
-NULL
?>
--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
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)
const FLOAT_CONSTANT = 3.14159265;
}
-Reflection::export(new ReflectionClass('just_constants'));
+echo new ReflectionClass('just_constants');
?>
--EXPECTF--
Class [ <user> class just_constants ] {
function foo() {
}
}
-Reflection::export(new ReflectionClass('Test'));
-?>
-===DONE===
-<?php exit(0); ?>
+echo new ReflectionClass('Test');
--EXPECTF--
Class [ <user> class Test ] {
@@ %sbug33389.php 3-18
}
}
}
-
-===DONE===
}
}
-Reflection::export(new ReflectionClass(new bar));
+echo new ReflectionClass(new bar);
?>
--EXPECTF--
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
--TEST--
-Reflection Bug #41061 ("visibility error" in ReflectionFunction::export())
+Reflection Bug #41061 ("visibility error" in ReflectionFunction::__toString())
--FILE--
<?php
}
}
-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); ?>
--TEST--
-Bug #45571 (ReflectionClass::export() shows superclasses' private static methods.)
+Bug #45571 (ReflectionClass::__toString() shows superclasses' private static methods.)
--FILE--
<?php
Class C extends A { }
-ReflectionClass::export("C");
+echo new ReflectionClass("C");
?>
--EXPECTF--
}
}
-ReflectionObject::export(new foo);
+echo new ReflectionObject(new foo);
?>
--EXPECTF--
} catch (Exception $e) { }
?>
ok
---EXPECT--
+--EXPECTF--
+Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
ok
}
-reflectionclass::export('foo');
-reflectionclass::export('bar');
+echo new ReflectionClass('foo'), "\n";
+echo new ReflectionClass('bar'), "\n";
?>
--EXPECTF--
===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===
SPL: Test shape of interface Countable.
--FILE--
<?php
-ReflectionClass::export('Countable');
+echo new ReflectionClass('Countable');
?>
--EXPECTF--
Interface [ <internal%s> interface Countable ] {
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 ] {