Skip to content

Commit

Permalink
Adds tests concerning arrow functions within a match
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Jun 4, 2021
1 parent 283a60f commit 1969b3c
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Zend/tests/arrow_functions/009.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--TEST--
Arrow functions in match
--FILE--
<?php

$fn = match (true) {
default => fn () => 1,
};
var_dump($fn());

$ret = match (true) {
default => (fn () => 2)(),
};
var_dump($ret);

$ret = match (true) {
default => (fn () => null)(),
};
var_dump($ret);

$fn = match (true) {
default => fn () {
return 3;
},
};
var_dump($fn());

$ret = match (true) {
default => (fn () {
return 4;
})(),
};
var_dump($ret);

$ret = match (true) {
default => (fn () {})(),
};
var_dump($ret);

?>
--EXPECT--
int(1)
int(2)
NULL
int(3)
int(4)
NULL

0 comments on commit 1969b3c

Please sign in to comment.