File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Zend/tests/short_functions Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,13 @@ Basic short functions return values.
5
5
6
6
function test(int $ a ) => $ a + 1 ;
7
7
8
- function test2(int $ b ) => return $ b . 'error ' ;
8
+ function test2(int $ b )
9
+ => $ b + 1 ;
9
10
10
- print test (5 );
11
+ print test (5 ) . PHP_EOL ;
12
+ print test2 (5 ) . PHP_EOL ;
11
13
12
14
?>
13
15
--EXPECT--
14
16
6
17
+ 6
Original file line number Diff line number Diff line change 1
1
--TEST--
2
- Basic short functions return values .
2
+ Short methods .
3
3
--FILE--
4
4
<?php
5
5
@@ -8,12 +8,17 @@ class Test {
8
8
public function __construct (private int $ b ) {}
9
9
10
10
public function addUp (int $ a ) => $ a + $ this ->b;
11
+
12
+ public function addUp2 (int $ a )
13
+ => $ a + $ this ->b;
11
14
}
12
15
13
16
$ t = new Test (1 );
14
17
15
- print $ t ->addUp (5 );
18
+ print $ t ->addUp (5 ) . PHP_EOL ;
19
+ print $ t ->addUp2 (5 ) . PHP_EOL ;
16
20
17
21
?>
18
22
--EXPECT--
19
23
6
24
+ 6
You can’t perform that action at this time.
0 commit comments