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