1--TEST--
2ReflectionClass::getModifierNames() basic tests
3--CREDITS--
4Felix De Vliegher <felix.devliegher@gmail.com>
5--FILE--
6<?php
7
8class a {}
9abstract class b {}
10final class c {}
11
12class x
13{
14    function __construct() {}
15    function __destruct() {}
16    private function a() {}
17    private static function b() {}
18    protected function c() {}
19    protected static function d() {}
20    public function e() {}
21    public static function f() {}
22    final function g() {}
23    function h() {}
24}
25
26abstract class y
27{
28    abstract function a();
29    abstract protected function b();
30}
31
32function dump_modifierNames($class) {
33    $obj = new ReflectionClass($class);
34    var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers()));
35}
36
37function dump_methodModifierNames($class) {
38    $obj = new ReflectionClass($class);
39    foreach($obj->getMethods() as $method) {
40        var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers()));
41    }
42}
43
44dump_modifierNames('a');
45dump_modifierNames('b');
46dump_modifierNames('c');
47
48dump_methodModifierNames('x');
49dump_methodModifierNames('y');
50
51?>
52--EXPECT--
53string(1) "a"
54array(0) {
55}
56string(1) "b"
57array(1) {
58  [0]=>
59  string(8) "abstract"
60}
61string(1) "c"
62array(1) {
63  [0]=>
64  string(5) "final"
65}
66string(14) "x::__construct"
67array(1) {
68  [0]=>
69  string(6) "public"
70}
71string(13) "x::__destruct"
72array(1) {
73  [0]=>
74  string(6) "public"
75}
76string(4) "x::a"
77array(1) {
78  [0]=>
79  string(7) "private"
80}
81string(4) "x::b"
82array(2) {
83  [0]=>
84  string(7) "private"
85  [1]=>
86  string(6) "static"
87}
88string(4) "x::c"
89array(1) {
90  [0]=>
91  string(9) "protected"
92}
93string(4) "x::d"
94array(2) {
95  [0]=>
96  string(9) "protected"
97  [1]=>
98  string(6) "static"
99}
100string(4) "x::e"
101array(1) {
102  [0]=>
103  string(6) "public"
104}
105string(4) "x::f"
106array(2) {
107  [0]=>
108  string(6) "public"
109  [1]=>
110  string(6) "static"
111}
112string(4) "x::g"
113array(2) {
114  [0]=>
115  string(5) "final"
116  [1]=>
117  string(6) "public"
118}
119string(4) "x::h"
120array(1) {
121  [0]=>
122  string(6) "public"
123}
124string(4) "y::a"
125array(2) {
126  [0]=>
127  string(8) "abstract"
128  [1]=>
129  string(6) "public"
130}
131string(4) "y::b"
132array(2) {
133  [0]=>
134  string(8) "abstract"
135  [1]=>
136  string(9) "protected"
137}
138