1--TEST-- 2ReflectionClass::getDocComment() 3--CREDITS-- 4Robin Fernandes <robinf@php.net> 5Steve Seear <stevseea@php.net> 6--FILE-- 7<?php 8/** 9 10 11 My 12Doc 13 * Comment 14for A 15 16* */ 17class A {} 18 19/** My DocComment for B */ 20class B extends A { } 21 22class C extends B {} 23 24/** 25 * Interface doc comment 26 */ 27 28 29 30 31interface I {} 32 33/*.* 34 * Not a doc comment 35 */ 36class D implements I {} 37 38/**** Not a doc comment */ 39class E extends C implements I {} {} 40 41/**?** Not a doc comment */ 42class F extends C implements I {} {} 43 44/** ** Doc comment for G */ 45final class G extends C implements I {} {} 46 47$classes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'I'); 48foreach ($classes as $class) { 49 echo "\n\n---> Doc comment for class $class:\n"; 50 $rc = new ReflectionClass($class); 51 var_dump($rc->getDocComment()); 52} 53 54 55?> 56--EXPECTF-- 57 58 59---> Doc comment for class A: 60string(%d) "/** 61 62 63 My 64Doc 65 * Comment 66for A 67 68* */" 69 70 71---> Doc comment for class B: 72string(26) "/** My DocComment for B */" 73 74 75---> Doc comment for class C: 76bool(false) 77 78 79---> Doc comment for class D: 80bool(false) 81 82 83---> Doc comment for class E: 84bool(false) 85 86 87---> Doc comment for class F: 88bool(false) 89 90 91---> Doc comment for class G: 92string(27) "/** ** Doc comment for G */" 93 94 95---> Doc comment for class I: 96string(%d) "/** 97 * Interface doc comment 98 */"