1--TEST--
2Test ReflectionProperty::getDocComment() usage.
3--INI--
4opcache.save_comments=1
5--FILE--
6<?php
7
8class A {
9    /**
10     * My Doc Comment for $a
11     *
12     */
13    public $a = 2, $b, $c = 1;
14    /**
15     * My Doc Comment for $d
16     */
17    var $d;
18    /**Not a doc comment */
19    private $e;
20    /**
21     * Doc comment for $f
22     */
23    static protected $f;
24}
25
26class B extends A {
27    public $a = 2;
28    /** A doc comment for $b */
29    var $b, $c = 1;
30    /** A doc comment for $e */
31    var $e;
32}
33
34foreach(array('A', 'B') as $class) {
35    $rc = new ReflectionClass($class);
36    $rps = $rc->getProperties();
37    foreach($rps as $rp) {
38        echo "\n\n---> Doc comment for $class::$" . $rp->getName() . ":\n";
39        var_dump($rp->getDocComment());
40    }
41}
42
43?>
44--EXPECTF--
45---> Doc comment for A::$a:
46string(%d) "/**
47     * My Doc Comment for $a
48     *
49     */"
50
51
52---> Doc comment for A::$b:
53bool(false)
54
55
56---> Doc comment for A::$c:
57bool(false)
58
59
60---> Doc comment for A::$d:
61string(%d) "/**
62     * My Doc Comment for $d
63     */"
64
65
66---> Doc comment for A::$e:
67bool(false)
68
69
70---> Doc comment for A::$f:
71string(%d) "/**
72     * Doc comment for $f
73     */"
74
75
76---> Doc comment for B::$a:
77bool(false)
78
79
80---> Doc comment for B::$b:
81string(%d) "/** A doc comment for $b */"
82
83
84---> Doc comment for B::$c:
85bool(false)
86
87
88---> Doc comment for B::$e:
89string(%d) "/** A doc comment for $e */"
90
91
92---> Doc comment for B::$d:
93string(%d) "/**
94     * My Doc Comment for $d
95     */"
96
97
98---> Doc comment for B::$f:
99string(%d) "/**
100     * Doc comment for $f
101     */"
102