2 Test ReflectionMethod::getClosure() function : error functionality
5 /* Prototype : public mixed ReflectionFunction::getClosure()
6 * Description: Returns a dynamically created closure for the method
7 * Source code: ext/reflection/php_reflection.c
11 echo "*** Testing ReflectionMethod::getClosure() : error conditions ***\n";
17 var_dump( "Static Example class, Hello World!" );
26 var_dump( "Example class, bar: " . $this->bar );
31 $class = new ReflectionClass( 'Example' );
32 $staticclass = new ReflectionClass( 'StaticExample' );
33 $method = $class->getMethod( 'foo' );
34 $staticmethod = $staticclass->getMethod( 'foo' );
35 $object = new Example();
36 $fakeobj = new StdClass();
38 echo "\n-- Testing ReflectionMethod::getClosure() function with invalid object --\n";
40 var_dump( $method->getClosure( $fakeobj ) );
41 } catch( Exception $e ) {
42 var_dump( $e->getMessage() );
47 *** Testing ReflectionMethod::getClosure() : error conditions ***
49 -- Testing ReflectionMethod::getClosure() function with invalid object --
50 string(72) "Given object is not an instance of the class this method was declared in"