]> granicus.if.org Git - php/blob
7defcb76e0
[php] /
1 --TEST--
2 Test ReflectionProperty::isDefault() usage.
3 --FILE--
4 <?php
5
6 function 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 "\n**********************************\n";
13 }
14
15 class TestClass {
16     public $pub;
17     static public $stat = "static property";
18     protected $prot = 4;
19     private $priv = "keepOut";
20 }
21
22 reflectProperty("TestClass", "pub");
23 reflectProperty("TestClass", "stat");
24 reflectProperty("TestClass", "prot");
25 reflectProperty("TestClass", "priv");
26
27 ?>
28 --EXPECT--
29 **********************************
30 Reflecting on property TestClass::pub
31
32 isDefault():
33 bool(true)
34
35 **********************************
36 **********************************
37 Reflecting on property TestClass::stat
38
39 isDefault():
40 bool(true)
41
42 **********************************
43 **********************************
44 Reflecting on property TestClass::prot
45
46 isDefault():
47 bool(true)
48
49 **********************************
50 **********************************
51 Reflecting on property TestClass::priv
52
53 isDefault():
54 bool(true)
55
56 **********************************