Skip to content

Commit 2eca4d2

Browse files
committed
Fix short functions.
1 parent 85dd6ee commit 2eca4d2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Zend/tests/short_functions/short-func.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
--TEST--
2-
2+
Basic short functions return values.
33
--FILE--
44
<?php
55

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

8+
function test2(int $b) => return $b . 'error';
9+
810
print test(5);
911

1012
?>

Zend/zend_language_parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ function_declaration_statement:
549549
{ $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2 | $13, $1, $4,
550550
zend_ast_get_str($3), $6, NULL, $11, $8, NULL); CG(extra_fn_flags) = $9; }
551551
| function returns_ref T_STRING backup_doc_comment '(' parameter_list ')' return_type
552-
backup_fn_flags '=>' inner_statement backup_fn_flags
552+
backup_fn_flags T_DOUBLE_ARROW inner_statement backup_fn_flags
553553
{ $$ = zend_ast_create_decl(ZEND_AST_FUNC_DECL, $2, $1, $4,
554554
zend_ast_get_str($3), $6, NULL, zend_ast_create(ZEND_AST_RETURN, $11), $8, NULL); CG(extra_fn_flags) = $9; }
555555
;

0 commit comments

Comments
 (0)