Skip to content

Commit 48f2aea

Browse files
committed
Adds tests concerning arrow functions within a match
1 parent 7a7778d commit 48f2aea

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Zend/tests/arrow_functions/009.phpt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--TEST--
2+
Arrow functions in match
3+
--FILE--
4+
<?php
5+
6+
$fn = match (true) {
7+
default => fn () => 1,
8+
};
9+
var_dump($fn());
10+
11+
$ret = match (true) {
12+
default => (fn () => 2)(),
13+
};
14+
var_dump($ret);
15+
16+
$ret = match (true) {
17+
default => (fn () => null)(),
18+
};
19+
var_dump($ret);
20+
21+
$fn = match (true) {
22+
default => fn () {
23+
return 3;
24+
},
25+
};
26+
var_dump($fn());
27+
28+
$ret = match (true) {
29+
default => (fn () {
30+
return 4;
31+
})(),
32+
};
33+
var_dump($ret);
34+
35+
$ret = match (true) {
36+
default => (fn () {})(),
37+
};
38+
var_dump($ret);
39+
40+
?>
41+
--EXPECT--
42+
int(1)
43+
int(2)
44+
NULL
45+
int(3)
46+
int(4)
47+
NULL

0 commit comments

Comments
 (0)