1--TEST--
2ReflectionMethod::getModifiers()
3--FILE--
4<?php
5
6function reflectMethodModifiers($class) {
7    $classInfo = new reflectionClass($class);
8    $methodArray = $classInfo->getMethods();
9
10    foreach ($methodArray as $method) {
11        echo "Modifiers for method $method->class::$method->name():\n";
12        printf("0x%08x\n", $method->getModifiers());
13        echo "\n\n";
14    }
15}
16
17class TestClass
18{
19    public function foo() {
20        echo "Called foo()\n";
21    }
22
23    static function stat() {
24        echo "Called stat()\n";
25    }
26
27    private function priv() {
28        echo "Called priv()\n";
29    }
30
31    protected function prot() {}
32
33    public final function fin() {}
34
35    public function __construct() {}
36
37    public function __destruct() {}
38
39    public function __call($a, $b) {}
40
41    public static function __callStatic($a, $b) {}
42
43    public function __clone() {}
44
45    public function __get($a) {}
46
47    public function __set($a, $b) {}
48
49    public function __unset($a) {}
50
51    public function __invoke() {}
52
53    public function __isset($a) {}
54
55    public function __tostring() {}
56
57    public function __sleep() {}
58
59    public function __wakeup() {}
60
61    public static function __set_state($a) {}
62
63    public function __autoload() {}
64
65    public function __serialize() {}
66
67    public function __unserialize($data) {}
68
69    public function __debugInfo() {}
70}
71
72class DerivedClass extends TestClass {}
73
74interface TestInterface {
75    public function int();
76    public function __clone();
77}
78
79abstract class AbstractClass {
80    public abstract function foo();
81}
82
83
84
85reflectMethodModifiers("TestClass");
86reflectMethodModifiers("DerivedClass");
87reflectMethodModifiers("TestInterface");
88reflectMethodModifiers("AbstractClass");
89
90$a = new ReflectionMethod('ReflectionMethod', 'getModifiers');
91
92echo "ReflectionMethod::getModifiers() modifiers:\n";
93printf("0x%08x\n", $a->getModifiers());
94
95?>
96--EXPECT--
97Modifiers for method TestClass::foo():
980x00000001
99
100
101Modifiers for method TestClass::stat():
1020x00000011
103
104
105Modifiers for method TestClass::priv():
1060x00000004
107
108
109Modifiers for method TestClass::prot():
1100x00000002
111
112
113Modifiers for method TestClass::fin():
1140x00000021
115
116
117Modifiers for method TestClass::__construct():
1180x00000001
119
120
121Modifiers for method TestClass::__destruct():
1220x00000001
123
124
125Modifiers for method TestClass::__call():
1260x00000001
127
128
129Modifiers for method TestClass::__callStatic():
1300x00000011
131
132
133Modifiers for method TestClass::__clone():
1340x00000001
135
136
137Modifiers for method TestClass::__get():
1380x00000001
139
140
141Modifiers for method TestClass::__set():
1420x00000001
143
144
145Modifiers for method TestClass::__unset():
1460x00000001
147
148
149Modifiers for method TestClass::__invoke():
1500x00000001
151
152
153Modifiers for method TestClass::__isset():
1540x00000001
155
156
157Modifiers for method TestClass::__tostring():
1580x00000001
159
160
161Modifiers for method TestClass::__sleep():
1620x00000001
163
164
165Modifiers for method TestClass::__wakeup():
1660x00000001
167
168
169Modifiers for method TestClass::__set_state():
1700x00000011
171
172
173Modifiers for method TestClass::__autoload():
1740x00000001
175
176
177Modifiers for method TestClass::__serialize():
1780x00000001
179
180
181Modifiers for method TestClass::__unserialize():
1820x00000001
183
184
185Modifiers for method TestClass::__debugInfo():
1860x00000001
187
188
189Modifiers for method TestClass::foo():
1900x00000001
191
192
193Modifiers for method TestClass::stat():
1940x00000011
195
196
197Modifiers for method TestClass::prot():
1980x00000002
199
200
201Modifiers for method TestClass::fin():
2020x00000021
203
204
205Modifiers for method TestClass::__construct():
2060x00000001
207
208
209Modifiers for method TestClass::__destruct():
2100x00000001
211
212
213Modifiers for method TestClass::__call():
2140x00000001
215
216
217Modifiers for method TestClass::__callStatic():
2180x00000011
219
220
221Modifiers for method TestClass::__clone():
2220x00000001
223
224
225Modifiers for method TestClass::__get():
2260x00000001
227
228
229Modifiers for method TestClass::__set():
2300x00000001
231
232
233Modifiers for method TestClass::__unset():
2340x00000001
235
236
237Modifiers for method TestClass::__invoke():
2380x00000001
239
240
241Modifiers for method TestClass::__isset():
2420x00000001
243
244
245Modifiers for method TestClass::__tostring():
2460x00000001
247
248
249Modifiers for method TestClass::__sleep():
2500x00000001
251
252
253Modifiers for method TestClass::__wakeup():
2540x00000001
255
256
257Modifiers for method TestClass::__set_state():
2580x00000011
259
260
261Modifiers for method TestClass::__autoload():
2620x00000001
263
264
265Modifiers for method TestClass::__serialize():
2660x00000001
267
268
269Modifiers for method TestClass::__unserialize():
2700x00000001
271
272
273Modifiers for method TestClass::__debugInfo():
2740x00000001
275
276
277Modifiers for method TestInterface::int():
2780x00000041
279
280
281Modifiers for method TestInterface::__clone():
2820x00000041
283
284
285Modifiers for method AbstractClass::foo():
2860x00000041
287
288
289ReflectionMethod::getModifiers() modifiers:
2900x00000001
291