1--TEST--
2ReflectionClass::getMethod()
3--CREDITS--
4Robin Fernandes <robinf@php.net>
5Steve Seear <stevseea@php.net>
6--FILE--
7<?php
8class pubf {
9	public function f() {}
10	static public function s() {}
11}
12class subpubf extends pubf {
13}
14
15class protf {
16	protected function f() {}
17	static protected function s() {}
18}
19class subprotf extends protf {
20}
21
22class privf {
23	private function f() {}
24	static private function s() {}
25}
26class subprivf extends privf  {
27}
28
29$classes = array("pubf", "subpubf", "protf", "subprotf",
30				 "privf", "subprivf");
31foreach($classes as $class) {
32	echo "Reflecting on class $class: \n";
33	$rc = new ReflectionClass($class);
34	echo "  --> Check for f(): ";
35	var_dump($rc->getMethod("f"));
36	echo "  --> Check for s(): ";
37	var_dump($rc->getMethod("s"));
38	echo "  --> Check for F(): ";
39	var_dump($rc->getMethod("F"));
40	echo "  --> Check for doesntExist(): ";
41	try {
42		var_dump($rc->getMethod("doesntExist"));
43	} catch (Exception $e) {
44		echo $e->getMessage() . "\n";
45	}
46}
47?>
48--EXPECTF--
49Reflecting on class pubf:
50  --> Check for f(): object(ReflectionMethod)#%d (2) {
51  [%u|b%"name"]=>
52  %unicode|string%(1) "f"
53  [%u|b%"class"]=>
54  %unicode|string%(4) "pubf"
55}
56  --> Check for s(): object(ReflectionMethod)#%d (2) {
57  [%u|b%"name"]=>
58  %unicode|string%(1) "s"
59  [%u|b%"class"]=>
60  %unicode|string%(4) "pubf"
61}
62  --> Check for F(): object(ReflectionMethod)#%d (2) {
63  [%u|b%"name"]=>
64  %unicode|string%(1) "f"
65  [%u|b%"class"]=>
66  %unicode|string%(4) "pubf"
67}
68  --> Check for doesntExist(): Method doesntExist does not exist
69Reflecting on class subpubf:
70  --> Check for f(): object(ReflectionMethod)#%d (2) {
71  [%u|b%"name"]=>
72  %unicode|string%(1) "f"
73  [%u|b%"class"]=>
74  %unicode|string%(4) "pubf"
75}
76  --> Check for s(): object(ReflectionMethod)#%d (2) {
77  [%u|b%"name"]=>
78  %unicode|string%(1) "s"
79  [%u|b%"class"]=>
80  %unicode|string%(4) "pubf"
81}
82  --> Check for F(): object(ReflectionMethod)#%d (2) {
83  [%u|b%"name"]=>
84  %unicode|string%(1) "f"
85  [%u|b%"class"]=>
86  %unicode|string%(4) "pubf"
87}
88  --> Check for doesntExist(): Method doesntExist does not exist
89Reflecting on class protf:
90  --> Check for f(): object(ReflectionMethod)#%d (2) {
91  [%u|b%"name"]=>
92  %unicode|string%(1) "f"
93  [%u|b%"class"]=>
94  %unicode|string%(5) "protf"
95}
96  --> Check for s(): object(ReflectionMethod)#%d (2) {
97  [%u|b%"name"]=>
98  %unicode|string%(1) "s"
99  [%u|b%"class"]=>
100  %unicode|string%(5) "protf"
101}
102  --> Check for F(): object(ReflectionMethod)#%d (2) {
103  [%u|b%"name"]=>
104  %unicode|string%(1) "f"
105  [%u|b%"class"]=>
106  %unicode|string%(5) "protf"
107}
108  --> Check for doesntExist(): Method doesntExist does not exist
109Reflecting on class subprotf:
110  --> Check for f(): object(ReflectionMethod)#%d (2) {
111  [%u|b%"name"]=>
112  %unicode|string%(1) "f"
113  [%u|b%"class"]=>
114  %unicode|string%(5) "protf"
115}
116  --> Check for s(): object(ReflectionMethod)#%d (2) {
117  [%u|b%"name"]=>
118  %unicode|string%(1) "s"
119  [%u|b%"class"]=>
120  %unicode|string%(5) "protf"
121}
122  --> Check for F(): object(ReflectionMethod)#%d (2) {
123  [%u|b%"name"]=>
124  %unicode|string%(1) "f"
125  [%u|b%"class"]=>
126  %unicode|string%(5) "protf"
127}
128  --> Check for doesntExist(): Method doesntExist does not exist
129Reflecting on class privf:
130  --> Check for f(): object(ReflectionMethod)#%d (2) {
131  [%u|b%"name"]=>
132  %unicode|string%(1) "f"
133  [%u|b%"class"]=>
134  %unicode|string%(5) "privf"
135}
136  --> Check for s(): object(ReflectionMethod)#%d (2) {
137  [%u|b%"name"]=>
138  %unicode|string%(1) "s"
139  [%u|b%"class"]=>
140  %unicode|string%(5) "privf"
141}
142  --> Check for F(): object(ReflectionMethod)#%d (2) {
143  [%u|b%"name"]=>
144  %unicode|string%(1) "f"
145  [%u|b%"class"]=>
146  %unicode|string%(5) "privf"
147}
148  --> Check for doesntExist(): Method doesntExist does not exist
149Reflecting on class subprivf:
150  --> Check for f(): object(ReflectionMethod)#%d (2) {
151  [%u|b%"name"]=>
152  %unicode|string%(1) "f"
153  [%u|b%"class"]=>
154  %unicode|string%(5) "privf"
155}
156  --> Check for s(): object(ReflectionMethod)#%d (2) {
157  [%u|b%"name"]=>
158  %unicode|string%(1) "s"
159  [%u|b%"class"]=>
160  %unicode|string%(5) "privf"
161}
162  --> Check for F(): object(ReflectionMethod)#%d (2) {
163  [%u|b%"name"]=>
164  %unicode|string%(1) "f"
165  [%u|b%"class"]=>
166  %unicode|string%(5) "privf"
167}
168  --> Check for doesntExist(): Method doesntExist does not exist
169