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