Skip to content

Commit 9d00be1

Browse files
committed
Verify new statements can access $this
1 parent fa3dd1a commit 9d00be1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/php/lang/ast/unittest/emit/InitializeWithExpressionsTest.class.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ public function run() {
6464
Assert::equals(new Handle(1), $r());
6565
}
6666

67+
#[Test]
68+
public function using_new_referencing_this() {
69+
$r= $this->run('use lang\ast\unittest\emit\Handle; class <T> {
70+
private $id= 1;
71+
private $h= new Handle($this->id);
72+
73+
public function run() {
74+
return $this->h;
75+
}
76+
}');
77+
Assert::equals(new Handle(1), $r);
78+
}
79+
6780
#[Test]
6881
public function using_anonymous_classes() {
6982
$r= $this->run('class <T> {

0 commit comments

Comments
 (0)