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