File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Using Reflection on promoted properties
3
+ --FILE--
4
+ <?php
5
+
6
+ class Test {
7
+ public function __construct (
8
+ public int $ x ,
9
+ /** @SomeAnnotation() */
10
+ public string $ y = "123 "
11
+ ) {}
12
+ }
13
+
14
+ $ rc = new ReflectionClass (Test::class);
15
+ echo $ rc , "\n" ;
16
+
17
+ $ y = $ rc ->getProperty ('y ' );
18
+ var_dump ($ y ->getDocComment ());
19
+
20
+ ?>
21
+ --EXPECTF--
22
+ Class [ <user> class Test ] {
23
+ @@ %s 3-9
24
+
25
+ - Constants [0] {
26
+ }
27
+
28
+ - Static properties [0] {
29
+ }
30
+
31
+ - Static methods [0] {
32
+ }
33
+
34
+ - Properties [2] {
35
+ Property [ public int $x ]
36
+ Property [ public string $y ]
37
+ }
38
+
39
+ - Methods [1] {
40
+ Method [ <user, ctor> public method __construct ] {
41
+ @@ %s 4 - 8
42
+
43
+ - Parameters [2] {
44
+ Parameter #0 [ <required> int $x ]
45
+ Parameter #1 [ <optional> string $y = '123' ]
46
+ }
47
+ }
48
+ }
49
+ }
50
+
51
+ bool(false)
You can’t perform that action at this time.
0 commit comments