1--TEST-- 2ReflectionMethod::getDocComment() 3--INI-- 4opcache.save_comments=1 5--FILE-- 6<?php 7/** 8 * My Doc Comment for A 9 */ 10class A { 11 /** 12 * My Doc Comment for A::f 13 */ 14 function f() {} 15 16 /** 17 * My Doc Comment for A::privf 18 */ 19 private function privf() {} 20 21 /** My Doc Comment for A::protStatf */ 22 protected static function protStatf() {} 23 24 /** 25 26 * My Doc Comment for A::finalStatPubf 27 */ 28 final static public function finalStatPubf() {} 29 30} 31 32 33class B extends A { 34 /*** Not a doc comment */ 35 function f() {} 36 37 /** * 38 * My Doc Comment for B::privf 39 */ 40 41 42 43 44 private function privf() {} 45 46 47 /** My Doc Comment for B::protStatf 48 49 50 51 52 */ 53 protected static function protStatf() {} 54 55} 56 57foreach (array('A', 'B') as $class) { 58 $rc = new ReflectionClass($class); 59 $rms = $rc->getMethods(); 60 foreach ($rms as $rm) { 61 echo "\n\n---> Doc comment for $class::" . $rm->getName() . "():\n"; 62 var_dump($rm->getDocComment()); 63 } 64} 65?> 66--EXPECTF-- 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