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