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