diff options
Diffstat (limited to 'ext/reflection')
30 files changed, 100 insertions, 556 deletions
diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt index c463bb72c1..05825ba97e 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 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_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_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_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_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/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_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_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_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_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/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 ab09ed01f0..5acf9de6c3 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: @@ -46,9 +42,3 @@ The parameter class is expected to be either a string or an object Non-existent property: Property TestClass::$nonExistentProperty does not exist - -Incorrect number of args: - -Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given 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/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 |