Skip to content

Commit 68d514b

Browse files
committed
Add reflection test
The annotation is missing.
1 parent 77d04d4 commit 68d514b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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)

0 commit comments

Comments
 (0)