Annotation of embedaddon/php/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionMethod::getDocComment()
! 3: --FILE--
! 4: <?php
! 5: /**
! 6: * My Doc Comment for A
! 7: */
! 8: class A {
! 9: /**
! 10: * My Doc Comment for A::f
! 11: */
! 12: function f() {}
! 13:
! 14: /**
! 15: * My Doc Comment for A::privf
! 16: */
! 17: private function privf() {}
! 18:
! 19: /** My Doc Comment for A::protStatf */
! 20: protected static function protStatf() {}
! 21:
! 22: /**
! 23:
! 24: * My Doc Comment for A::finalStatPubf
! 25: */
! 26: final static public function finalStatPubf() {}
! 27:
! 28: }
! 29:
! 30:
! 31: class B extends A {
! 32: /*** Not a doc comment */
! 33: function f() {}
! 34:
! 35: /** *
! 36: * My Doc Comment for B::privf
! 37: */
! 38:
! 39:
! 40:
! 41:
! 42: private function privf() {}
! 43:
! 44:
! 45: /** My Doc Comment for B::protStatf
! 46:
! 47:
! 48:
! 49:
! 50: */
! 51: protected static function protStatf() {}
! 52:
! 53: }
! 54:
! 55: foreach (array('A', 'B') as $class) {
! 56: $rc = new ReflectionClass($class);
! 57: $rms = $rc->getMethods();
! 58: foreach ($rms as $rm) {
! 59: echo "\n\n---> Doc comment for $class::" . $rm->getName() . "():\n";
! 60: var_dump($rm->getDocComment());
! 61: }
! 62: }
! 63: ?>
! 64: --EXPECTF--
! 65:
! 66:
! 67: ---> Doc comment for A::f():
! 68: string(%d) "/**
! 69: * My Doc Comment for A::f
! 70: */"
! 71:
! 72:
! 73: ---> Doc comment for A::privf():
! 74: string(%d) "/**
! 75: * My Doc Comment for A::privf
! 76: */"
! 77:
! 78:
! 79: ---> Doc comment for A::protStatf():
! 80: string(%d) "/** My Doc Comment for A::protStatf */"
! 81:
! 82:
! 83: ---> Doc comment for A::finalStatPubf():
! 84: string(%d) "/**
! 85:
! 86: * My Doc Comment for A::finalStatPubf
! 87: */"
! 88:
! 89:
! 90: ---> Doc comment for B::f():
! 91: bool(false)
! 92:
! 93:
! 94: ---> Doc comment for B::privf():
! 95: string(%d) "/** *
! 96: * My Doc Comment for B::privf
! 97: */"
! 98:
! 99:
! 100: ---> Doc comment for B::protStatf():
! 101: string(%d) "/** My Doc Comment for B::protStatf
! 102:
! 103:
! 104:
! 105:
! 106: */"
! 107:
! 108:
! 109: ---> Doc comment for B::finalStatPubf():
! 110: string(%d) "/**
! 111:
! 112: * My Doc Comment for A::finalStatPubf
! 113: */"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>