Annotation of embedaddon/php/ext/reflection/tests/005.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ReflectionMethod::getDocComment() uses wrong comment block
                      3: --FILE--
                      4: <?php
                      5: 
                      6: function strip_doc_comment($c)
                      7: {
                      8:        if (!strlen($c) || $c === false) return $c;
                      9:        return trim(substr($c, 3, -2));
                     10: }
                     11: 
                     12: /** Comment for class A */
                     13: class A
                     14: {
                     15:        /** Method A::bla()
                     16:         */
                     17:        function bla()
                     18:        {
                     19:        }
                     20: 
                     21:     function foo() {
                     22:         /**
                     23:         * This is a valid comment inside a method
                     24:         */
                     25:     }
                     26: 
                     27:     function bar() {
                     28:         // I don't have a doc comment....
                     29:     }
                     30: 
                     31:     /**
                     32:      * Comment for A::baz()
                     33:      */
                     34:     function baz() {
                     35:     }
                     36: }
                     37: 
                     38: $r = new ReflectionClass('A');
                     39: var_dump(strip_doc_comment($r->getDocComment()));
                     40: 
                     41: foreach($r->getMethods() as $m)
                     42: {
                     43:        var_dump(strip_doc_comment($m->getDocComment()));
                     44: }
                     45: 
                     46: ?>
                     47: ===DONE===
                     48: --EXPECT--
                     49: string(19) "Comment for class A"
                     50: string(15) "Method A::bla()"
                     51: bool(false)
                     52: bool(false)
                     53: string(22) "* Comment for A::baz()"
                     54: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>