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==DONE== 53--EXPECT-- 54string(1) "a" 55array(0) { 56} 57string(1) "b" 58array(1) { 59 [0]=> 60 string(8) "abstract" 61} 62string(1) "c" 63array(1) { 64 [0]=> 65 string(5) "final" 66} 67string(14) "x::__construct" 68array(1) { 69 [0]=> 70 string(6) "public" 71} 72string(13) "x::__destruct" 73array(1) { 74 [0]=> 75 string(6) "public" 76} 77string(4) "x::a" 78array(1) { 79 [0]=> 80 string(7) "private" 81} 82string(4) "x::b" 83array(2) { 84 [0]=> 85 string(7) "private" 86 [1]=> 87 string(6) "static" 88} 89string(4) "x::c" 90array(1) { 91 [0]=> 92 string(9) "protected" 93} 94string(4) "x::d" 95array(2) { 96 [0]=> 97 string(9) "protected" 98 [1]=> 99 string(6) "static" 100} 101string(4) "x::e" 102array(1) { 103 [0]=> 104 string(6) "public" 105} 106string(4) "x::f" 107array(2) { 108 [0]=> 109 string(6) "public" 110 [1]=> 111 string(6) "static" 112} 113string(4) "x::g" 114array(2) { 115 [0]=> 116 string(5) "final" 117 [1]=> 118 string(6) "public" 119} 120string(4) "x::h" 121array(1) { 122 [0]=> 123 string(6) "public" 124} 125string(4) "y::a" 126array(2) { 127 [0]=> 128 string(8) "abstract" 129 [1]=> 130 string(6) "public" 131} 132string(4) "y::b" 133array(2) { 134 [0]=> 135 string(8) "abstract" 136 [1]=> 137 string(9) "protected" 138} 139==DONE== 140