Skip to content

Commit d1c2af7

Browse files
committed
Improve tests.
1 parent 1ddc64f commit d1c2af7

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Short functions with match statements.
3+
--FILE--
4+
<?php
5+
6+
function pick_one(int $a) => match($a) {
7+
1 => 'One',
8+
2 => 'Two',
9+
3 => 'Three',
10+
default => 'More',
11+
};
12+
13+
print pick_one(1) . PHP_EOL;
14+
print pick_one(2) . PHP_EOL;
15+
print pick_one(3) . PHP_EOL;
16+
print pick_one(4) . PHP_EOL;
17+
18+
?>
19+
--EXPECT--
20+
One
21+
Two
22+
Three
23+
More

Zend/tests/short_functions/short-func.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Basic short functions return values.
55

66
function test(int $a) => $a + 1;
77

8-
function test2(int $b)
8+
function test2(int $b): int
99
=> $b + 1;
1010

1111
print test(5) . PHP_EOL;

Zend/tests/short_functions/short-method.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Test {
99

1010
public function addUp(int $a) => $a + $this->b;
1111

12-
public function addUp2(int $a)
12+
public function addUp2(int $a): int
1313
=> $a + $this->b;
1414
}
1515

0 commit comments

Comments
 (0)