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 68 69---> Doc comment for A::f(): 70string(%d) "/** 71 * My Doc Comment for A::f 72 */" 73 74 75---> Doc comment for A::privf(): 76string(%d) "/** 77 * My Doc Comment for A::privf 78 */" 79 80 81---> Doc comment for A::protStatf(): 82string(%d) "/** My Doc Comment for A::protStatf */" 83 84 85---> Doc comment for A::finalStatPubf(): 86string(%d) "/** 87 88 * My Doc Comment for A::finalStatPubf 89 */" 90 91 92---> Doc comment for B::f(): 93bool(false) 94 95 96---> Doc comment for B::privf(): 97string(%d) "/** * 98 * My Doc Comment for B::privf 99 */" 100 101 102---> Doc comment for B::protStatf(): 103string(%d) "/** My Doc Comment for B::protStatf 104 105 106 107 108 */" 109 110 111---> Doc comment for B::finalStatPubf(): 112string(%d) "/** 113 114 * My Doc Comment for A::finalStatPubf 115 */" 116