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---> 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 */" 99