Skip to content

Commit a321734

Browse files
committed
Add test for fn() => ... style closures
1 parent 0c84bef commit a321734

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function run() { return $this->length(...); }
5252
}
5353

5454
#[Test]
55-
public function variable_function() {
55+
public function string_reference() {
5656
$this->verify('class <T> {
5757
public function run() {
5858
$func= "strlen";
@@ -62,7 +62,17 @@ public function run() {
6262
}
6363

6464
#[Test]
65-
public function instance_method_reference() {
65+
public function fn_reference() {
66+
$this->verify('class <T> {
67+
public function run() {
68+
$func= fn($arg) => strlen($arg);
69+
return $func(...);
70+
}
71+
}');
72+
}
73+
74+
#[Test]
75+
public function instance_property_reference() {
6676
$this->verify('class <T> {
6777
private $func= "strlen";
6878
public function run() {

0 commit comments

Comments
 (0)