xref: /PHP-5.3/ext/reflection/tests/005.phpt (revision 610c7fbe)
1--TEST--
2ReflectionMethod::getDocComment() uses wrong comment block
3--FILE--
4<?php
5
6function 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 */
13class 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');
39var_dump(strip_doc_comment($r->getDocComment()));
40
41foreach($r->getMethods() as $m)
42{
43	var_dump(strip_doc_comment($m->getDocComment()));
44}
45
46?>
47===DONE===
48--EXPECT--
49string(19) "Comment for class A"
50string(15) "Method A::bla()"
51bool(false)
52bool(false)
53string(22) "* Comment for A::baz()"
54===DONE===
55