summaryrefslogtreecommitdiff
path: root/ext/reflection/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection/tests')
-rw-r--r--ext/reflection/tests/004.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_002.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_error.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_002.phpt26
-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_getProperty_002.phpt26
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_002.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt29
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_001.phpt37
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt25
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstance_001.phpt19
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt25
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_001.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_bug66218.phpt1
-rw-r--r--ext/reflection/tests/ReflectionMethod_006.phpt74
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt70
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_error.phpt25
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionObject_getName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt37
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionParameter_003.phpt2
-rw-r--r--ext/reflection/tests/ReflectionProperty_error.phpt33
-rw-r--r--ext/reflection/tests/ReflectionProperty_export_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_getValue_error.phpt30
-rw-r--r--ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt7
-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/bug30148.phpt36
-rw-r--r--ext/reflection/tests/bug38942.phpt35
-rw-r--r--ext/reflection/tests/bug47254.phpt5
-rw-r--r--ext/reflection/tests/bug74673.phpt11
-rw-r--r--ext/reflection/tests/bug76536.phpt2
-rw-r--r--ext/reflection/tests/request38992.phpt21
51 files changed, 136 insertions, 924 deletions
diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt
index 36ae406b43..924c3fe283 100644
--- a/ext/reflection/tests/004.phpt
+++ b/ext/reflection/tests/004.phpt
@@ -4,7 +4,7 @@ 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/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
index c463bb72c1..7d8a312f51 100644
--- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
@@ -4,7 +4,7 @@ ReflectionClass::__constructor() - bad arguments
<?php
try {
var_dump(new ReflectionClass());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
@@ -34,7 +34,7 @@ try {
try {
var_dump(new ReflectionClass("stdClass", 1));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
@@ -46,21 +46,12 @@ try {
?>
--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_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
index d9183442c4..784fc6a5fb 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
@@ -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_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
index 5260e719a3..020ac6f7f5 100644
--- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
@@ -8,30 +8,14 @@ class C {
$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_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
index 5db9d8f3d3..df6880aedb 100644
--- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
@@ -9,48 +9,7 @@ class NewCtor {
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();
@@ -63,21 +22,6 @@ foreach ($classes as $class) {
}
?>
---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_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
index 1eb084214b..424550f67a 100644
--- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
@@ -13,12 +13,12 @@ $rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
var_dump($rc->getMethod());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getMethod("f", "f"));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -43,32 +43,24 @@ try {
}
try {
var_dump($rc->getMethod(array(1,2,3)));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getMethod(new C));
-} catch (Exception $e) {
+} 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() expects parameter 1 to be string, array given
+ReflectionClass::getMethod() expects parameter 1 to be string, object given
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_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
index 68522e097a..d9a2ebcd71 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
@@ -13,12 +13,12 @@ $rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
var_dump($rc->getProperty());
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getProperty("a", "a"));
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -43,30 +43,22 @@ try {
}
try {
var_dump($rc->getProperty(array(1,2,3)));
-} catch (exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getProperty(new C));
-} catch (exception $e) {
+} 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() expects parameter 1 to be string, array given
+ReflectionClass::getProperty() expects parameter 1 to be string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
index 52fa378eb6..7c071e5ba0 100644
--- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
@@ -12,12 +12,12 @@ class C {
$rc = new ReflectionClass('C');
try {
var_dump($rc->getStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->getStaticPropertyValue());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -32,20 +32,15 @@ try {
}
try {
var_dump($rc->getStaticPropertyValue(array(1,2,3)));
-} catch (Exception $e) {
+} 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() expects parameter 1 to be string, array given
diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
index 14c847401d..257d9aa9da 100644
--- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
@@ -11,30 +11,14 @@ class C {
$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_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
index 63fe8791fc..77f2865a31 100644
--- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
@@ -11,30 +11,14 @@ class C {
$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_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
index 753890394f..a1bbb9e73c 100644
--- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
@@ -11,30 +11,14 @@ class C {
$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 91398867ec..b0deab33da 100644
--- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
@@ -41,12 +41,12 @@ foreach ($rcs as $childName => $child) {
echo "\n\nTest bad arguments:\n";
try {
var_dump($rcs['A']->implementsInterface());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rcs['A']->implementsInterface('C', 'C'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -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
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Interface ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
index 1378edd3d2..e688b40f46 100644
--- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
@@ -17,39 +17,16 @@ class privateCtorNew {
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 ) {
+$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_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
index 10a86d9136..af4ce9d2f4 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
@@ -35,16 +35,6 @@ foreach($classes as $class) {
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_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
index 368ea7d7ec..03d17e223e 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
@@ -11,12 +11,12 @@ $rc = new ReflectionClass('A');
echo "\n\nTest bad arguments:\n";
try {
var_dump($rc->isSubclassOf());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -35,14 +35,10 @@ try {
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
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Class ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
index 068710311d..11bd44077f 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
@@ -5,11 +5,6 @@ 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) {
@@ -32,28 +27,17 @@ 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')));
-} catch (Throwable $e) {
- 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) {
@@ -85,13 +69,6 @@ try {
}
?>
--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..de4fe65ace 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
@@ -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() expects parameter 1 to be 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..bf68098a7d 100644
--- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
@@ -5,11 +5,6 @@ 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) {
@@ -28,20 +23,15 @@ class D {
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());
} catch (Throwable $e) {
@@ -78,13 +68,6 @@ try {
}
?>
--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_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
index fb472681ca..6d3cf3a44f 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
@@ -12,17 +12,17 @@ class C {
$rc = new ReflectionClass('C');
try {
var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->setStaticPropertyValue());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($rc->setStaticPropertyValue(null));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -37,23 +37,16 @@ try {
}
try {
var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
-} catch (Exception $e) {
+} 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() expects parameter 1 to be string, array given
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
index a83900a123..352a79ece8 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
@@ -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..9406c2e5d1 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -265,7 +265,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method newInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $args ]
+ Parameter #0 [ <optional> ...$args ]
}
}
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/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt
index 627dc96f32..81f8116d77 100644
--- a/ext/reflection/tests/ReflectionMethod_006.phpt
+++ b/ext/reflection/tests/ReflectionMethod_006.phpt
@@ -17,79 +17,7 @@ try {
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_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_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
index d3b9ca3c81..d1e7ee68fb 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
@@ -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 ) {
@@ -55,19 +47,6 @@ try {
--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_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
index d1a19c7116..d867993599 100644
--- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
@@ -75,13 +75,9 @@ 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());
?>
@@ -234,9 +230,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..34e73c9a69 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(74) "ReflectionMethod::invokeArgs() expects parameter 2 to be array, bool given"
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
index 0c87a66153..156cc9db52 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
@@ -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..6711feb4ac 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
@@ -60,8 +60,16 @@ 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";
@@ -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() expects parameter 1 to be 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..4fa86eb363 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());
}
@@ -59,9 +59,7 @@ try {
?>
--EXPECTF--
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(71) "ReflectionMethod::invoke() expects parameter 1 to be 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/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
index aecc9b97d2..fee873fe01 100644
--- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
@@ -9,14 +9,6 @@ class NewCtor {
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
class X {
function Y() {}
}
@@ -24,15 +16,6 @@ class X {
class Y extends X {
}
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
class B {
function B() {}
}
@@ -48,8 +31,8 @@ class D1 extends C {
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);
@@ -63,21 +46,12 @@ foreach ($classes as $class) {
}
?>
---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_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
index 675bbdde8d..3baa8a0950 100644
--- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
@@ -30,54 +30,21 @@ class privateCtorNew {
}
}
-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()
);
-foreach($reflectionObjects as $reflectionObject ) {
+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_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
index f05197ebaf..a2484f9dc2 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
@@ -11,12 +11,12 @@ $ro = new ReflectionObject(new C);
echo "\n\nTest bad arguments:\n";
try {
var_dump($ro->isSubclassOf());
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
var_dump($ro->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
+} catch (TypeError $e) {
echo $e->getMessage() . "\n";
}
try {
@@ -35,14 +35,10 @@ try {
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
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Class ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
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/ReflectionParameter_003.phpt b/ext/reflection/tests/ReflectionParameter_003.phpt
index cc092bffcc..581c486f62 100644
--- a/ext/reflection/tests/ReflectionParameter_003.phpt
+++ b/ext/reflection/tests/ReflectionParameter_003.phpt
@@ -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/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt
index c8a2f11ee1..a7fdff5000 100644
--- a/ext/reflection/tests/ReflectionProperty_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_error.phpt
@@ -24,39 +24,8 @@ try {
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_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt
index 114b4c0ac8..446fedf0a3 100644
--- a/ext/reflection/tests/ReflectionProperty_export_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_export_error.phpt
@@ -32,10 +32,6 @@ 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:
@@ -52,13 +48,3 @@ 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_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
index 3bca85e4b6..52e9d1d2ef 100644
--- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
@@ -18,15 +18,6 @@ $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');
@@ -51,21 +42,6 @@ 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:
-
-Warning: ReflectionProperty::getValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
Instance without property:
Static property / too many args:
@@ -79,8 +55,8 @@ Cannot access non-public member TestClass::$prot
Invalid instance:
-Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:47
+Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:%d
Stack trace:
-#0 %s(47): ReflectionProperty->getValue(Object(AnotherClass))
+#0 %s(%d): ReflectionProperty->getValue(Object(AnotherClass))
#1 {main}
- thrown in %s on line 47
+ thrown in %s on line %d
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_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/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/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/bug47254.phpt b/ext/reflection/tests/bug47254.phpt
index e3ce114c9c..b6f33fcfc6 100644
--- a/ext/reflection/tests/bug47254.phpt
+++ b/ext/reflection/tests/bug47254.phpt
@@ -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/bug74673.phpt b/ext/reflection/tests/bug74673.phpt
index 47f7604e8b..42675f263e 100644
--- a/ext/reflection/tests/bug74673.phpt
+++ b/ext/reflection/tests/bug74673.phpt
@@ -3,10 +3,6 @@ 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)
@@ -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/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/request38992.phpt b/ext/reflection/tests/request38992.phpt
index 8c0052fd85..e6eab83415 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() expects parameter 1 to be object, string given
+ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given