1--TEST-- 2ReflectionMethod::getDocComment() 3--FILE-- 4<?php 5/** 6 * My Doc Comment for A 7 */ 8class A { 9 /** 10 * My Doc Comment for A::f 11 */ 12 function f() {} 13 14 /** 15 * My Doc Comment for A::privf 16 */ 17 private function privf() {} 18 19 /** My Doc Comment for A::protStatf */ 20 protected static function protStatf() {} 21 22 /** 23 24 * My Doc Comment for A::finalStatPubf 25 */ 26 final static public function finalStatPubf() {} 27 28} 29 30 31class B extends A { 32 /*** Not a doc comment */ 33 function f() {} 34 35 /** * 36 * My Doc Comment for B::privf 37 */ 38 39 40 41 42 private function privf() {} 43 44 45 /** My Doc Comment for B::protStatf 46 47 48 49 50 */ 51 protected static function protStatf() {} 52 53} 54 55foreach (array('A', 'B') as $class) { 56 $rc = new ReflectionClass($class); 57 $rms = $rc->getMethods(); 58 foreach ($rms as $rm) { 59 echo "\n\n---> Doc comment for $class::" . $rm->getName() . "():\n"; 60 var_dump($rm->getDocComment()); 61 } 62} 63?> 64--EXPECTF-- 65 66 67---> Doc comment for A::f(): 68string(%d) "/** 69 * My Doc Comment for A::f 70 */" 71 72 73---> Doc comment for A::privf(): 74string(%d) "/** 75 * My Doc Comment for A::privf 76 */" 77 78 79---> Doc comment for A::protStatf(): 80string(%d) "/** My Doc Comment for A::protStatf */" 81 82 83---> Doc comment for A::finalStatPubf(): 84string(%d) "/** 85 86 * My Doc Comment for A::finalStatPubf 87 */" 88 89 90---> Doc comment for B::f(): 91bool(false) 92 93 94---> Doc comment for B::privf(): 95string(%d) "/** * 96 * My Doc Comment for B::privf 97 */" 98 99 100---> Doc comment for B::protStatf(): 101string(%d) "/** My Doc Comment for B::protStatf 102 103 104 105 106 */" 107 108 109---> Doc comment for B::finalStatPubf(): 110string(%d) "/** 111 112 * My Doc Comment for A::finalStatPubf 113 */" 114