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