1--TEST--
2Test usage of ReflectionProperty methods isDefault(), getModifiers(), getDeclaringClass() and getDocComment().
3--INI--
4opcache.save_comments=1
5--FILE--
6<?php
7
8function reflectProperty($class, $property) {
9    $propInfo = new ReflectionProperty($class, $property);
10    echo "**********************************\n";
11    echo "Reflecting on property $class::$property\n\n";
12    echo "isDefault():\n";
13    var_dump($propInfo->isDefault());
14    echo "getModifiers():\n";
15    var_dump($propInfo->getModifiers());
16    echo "getDeclaringClass():\n";
17    var_dump($propInfo->getDeclaringClass());
18    echo "getDocComment():\n";
19    var_dump($propInfo->getDocComment());
20    echo "\n**********************************\n";
21}
22
23class TestClass {
24    public $pub;
25    static public $stat = "static property";
26    /**
27     * This property has a comment.
28     */
29    protected $prot = 4;
30    private $priv = "keepOut";
31}
32
33reflectProperty("TestClass", "pub");
34reflectProperty("TestClass", "stat");
35reflectProperty("TestClass", "prot");
36reflectProperty("TestClass", "priv");
37
38?>
39--EXPECTF--
40**********************************
41Reflecting on property TestClass::pub
42
43isDefault():
44bool(true)
45getModifiers():
46int(1)
47getDeclaringClass():
48object(ReflectionClass)#%d (1) {
49  ["name"]=>
50  string(9) "TestClass"
51}
52getDocComment():
53bool(false)
54
55**********************************
56**********************************
57Reflecting on property TestClass::stat
58
59isDefault():
60bool(true)
61getModifiers():
62int(17)
63getDeclaringClass():
64object(ReflectionClass)#%d (1) {
65  ["name"]=>
66  string(9) "TestClass"
67}
68getDocComment():
69bool(false)
70
71**********************************
72**********************************
73Reflecting on property TestClass::prot
74
75isDefault():
76bool(true)
77getModifiers():
78int(2)
79getDeclaringClass():
80object(ReflectionClass)#%d (1) {
81  ["name"]=>
82  string(9) "TestClass"
83}
84getDocComment():
85string(%d) "/**
86     * This property has a comment.
87     */"
88
89**********************************
90**********************************
91Reflecting on property TestClass::priv
92
93isDefault():
94bool(true)
95getModifiers():
96int(4)
97getDeclaringClass():
98object(ReflectionClass)#%d (1) {
99  ["name"]=>
100  string(9) "TestClass"
101}
102getDocComment():
103bool(false)
104
105**********************************
106