Skip to content

Commit cd323b6

Browse files
Reflection: add lazy ghost tests for phpGH-15902
Split from patch in phpGH-15922 since lazy ghosts are 8.4+
1 parent 55266d4 commit cd323b6

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
ReflectionClass object default property - used to say "..."
3+
--FILE--
4+
<?php
5+
6+
class C {
7+
public stdClass $a = FOO;
8+
}
9+
$reflector = new ReflectionClass(C::class);
10+
$c = $reflector->newLazyGhost(function () {});
11+
12+
define('FOO', new stdClass);
13+
14+
$c->a;
15+
16+
var_dump( (string)$reflector );
17+
18+
?>
19+
--EXPECTF--
20+
string(%d) "Class [ <user> class C ] {
21+
@@ %sReflectionClass-dots.php %d-%d
22+
23+
- Constants [0] {
24+
}
25+
26+
- Static properties [0] {
27+
}
28+
29+
- Static methods [0] {
30+
}
31+
32+
- Properties [1] {
33+
Property [ public stdClass $a = object(stdClass) ]
34+
}
35+
36+
- Methods [0] {
37+
}
38+
}
39+
"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
ReflectionProperty object default - used to say "..."
3+
--FILE--
4+
<?php
5+
6+
class C {
7+
public stdClass $a = FOO;
8+
}
9+
$reflector = new ReflectionProperty(C::class, 'a');
10+
$lazyFactory = new ReflectionClass(C::class);
11+
$c = $lazyFactory->newLazyGhost(function () {});
12+
13+
define('FOO', new stdClass);
14+
15+
$c->a;
16+
17+
var_dump( (string)$reflector );
18+
19+
?>
20+
--EXPECTF--
21+
string(%d) "Property [ public stdClass $a = object(stdClass) ]
22+
"

0 commit comments

Comments
 (0)