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 __destruct() {}
36
37    public function __call($a, $b) {}
38
39    public function __clone() {}
40
41    public function __get($a) {}
42
43    public function __set($a, $b) {}
44
45    public function __unset($a) {}
46
47    public function __isset($a) {}
48
49    public function __tostring() {}
50
51    public function __sleep() {}
52
53    public function __wakeup() {}
54
55    public function __set_state() {}
56
57    public function __autoload() {}
58}
59
60class DerivedClass extends TestClass {}
61
62interface TestInterface {
63	public function int();
64	public function __clone();
65}
66
67abstract class AbstractClass {
68	public abstract function foo();
69}
70
71
72
73reflectMethodModifiers("TestClass");
74reflectMethodModifiers("DerivedClass");
75reflectMethodModifiers("TestInterface");
76reflectMethodModifiers("AbstractClass");
77
78echo "Wrong number of params:\n";
79$a = new ReflectionMethod('TestClass::foo');
80$a->getModifiers(1);
81
82$a = new ReflectionMethod('ReflectionMethod::getModifiers');
83
84echo "\nReflectionMethod::getModifiers() modifiers:\n";
85printf("0x%08x\n", $a->getModifiers());
86
87?>
88--EXPECTF--
89Modifiers for method TestClass::foo():
900x08010100
91
92
93Modifiers for method TestClass::stat():
940x08000101
95
96
97Modifiers for method TestClass::priv():
980x08010400
99
100
101Modifiers for method TestClass::prot():
1020x08010200
103
104
105Modifiers for method TestClass::fin():
1060x08010104
107
108
109Modifiers for method TestClass::__destruct():
1100x08004100
111
112
113Modifiers for method TestClass::__call():
1140x08000100
115
116
117Modifiers for method TestClass::__clone():
1180x08008100
119
120
121Modifiers for method TestClass::__get():
1220x08000100
123
124
125Modifiers for method TestClass::__set():
1260x08000100
127
128
129Modifiers for method TestClass::__unset():
1300x08000100
131
132
133Modifiers for method TestClass::__isset():
1340x08000100
135
136
137Modifiers for method TestClass::__tostring():
1380x08000100
139
140
141Modifiers for method TestClass::__sleep():
1420x08010100
143
144
145Modifiers for method TestClass::__wakeup():
1460x08010100
147
148
149Modifiers for method TestClass::__set_state():
1500x08010100
151
152
153Modifiers for method TestClass::__autoload():
1540x08010100
155
156
157Modifiers for method TestClass::foo():
1580x08010100
159
160
161Modifiers for method TestClass::stat():
1620x08000101
163
164
165Modifiers for method TestClass::priv():
1660x08010400
167
168
169Modifiers for method TestClass::prot():
1700x08010200
171
172
173Modifiers for method TestClass::fin():
1740x08010104
175
176
177Modifiers for method TestClass::__destruct():
1780x08004100
179
180
181Modifiers for method TestClass::__call():
1820x08000100
183
184
185Modifiers for method TestClass::__clone():
1860x08008100
187
188
189Modifiers for method TestClass::__get():
1900x08000100
191
192
193Modifiers for method TestClass::__set():
1940x08000100
195
196
197Modifiers for method TestClass::__unset():
1980x08000100
199
200
201Modifiers for method TestClass::__isset():
2020x08000100
203
204
205Modifiers for method TestClass::__tostring():
2060x08000100
207
208
209Modifiers for method TestClass::__sleep():
2100x08010100
211
212
213Modifiers for method TestClass::__wakeup():
2140x08010100
215
216
217Modifiers for method TestClass::__set_state():
2180x08010100
219
220
221Modifiers for method TestClass::__autoload():
2220x08010100
223
224
225Modifiers for method TestInterface::int():
2260x08000102
227
228
229Modifiers for method TestInterface::__clone():
2300x08000102
231
232
233Modifiers for method AbstractClass::foo():
2340x08010102
235
236
237Wrong number of params:
238
239Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %sReflectionMethod_getModifiers_basic.php on line %d
240
241ReflectionMethod::getModifiers() modifiers:
2420x00000100
243