Skip to content

Commit 792e541

Browse files
committed
Add test for parent hook call in generator
1 parent 2d011fc commit 792e541

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Allow calling parent get in generator property hooks
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
public $prop = 42;
8+
}
9+
10+
class B extends A {
11+
public $prop {
12+
get {
13+
yield parent::$prop::get() + 1;
14+
yield parent::$prop::get() + 2;
15+
yield parent::$prop::get() + 3;
16+
}
17+
}
18+
}
19+
20+
$b = new B();
21+
foreach ($b->prop as $value) {
22+
var_dump($value);
23+
}
24+
25+
?>
26+
--EXPECT--
27+
int(43)
28+
int(44)
29+
int(45)

0 commit comments

Comments
 (0)